From 6858c70e1af0df916e1c788e95bb5d355e6870f1 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 19:51:52 +0000 Subject: [PATCH 1/5] fix: simplify logic for HTTP/1.1 REST fallback option For the `fallback` parameter, all values considered as `true` in Boolean context will enable HTTP/1.1 REST fallback, since the other fallback transport, proto over HTTP, is removed from `google-gax` v4. PiperOrigin-RevId: 559812260 Source-Link: https://github.com/googleapis/googleapis/commit/6a6fd29a79fe2846001d90d93e79a19fcc303b85 Source-Link: https://github.com/googleapis/googleapis-gen/commit/56c16657e7a59122b1da94771a9ef40989c282c0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 --- 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/package.json | 60 + .../protos/google/logging/v2/log_entry.proto | 280 + .../v2/protos/google/logging/v2/logging.proto | 483 ++ .../google/logging/v2/logging_config.proto | 2317 ++++++ .../google/logging/v2/logging_metrics.proto | 339 + .../v2/config_service_v2.copy_log_entries.js | 74 + .../v2/config_service_v2.create_bucket.js | 78 + .../config_service_v2.create_bucket_async.js | 79 + .../v2/config_service_v2.create_exclusion.js | 74 + .../v2/config_service_v2.create_link.js | 78 + .../v2/config_service_v2.create_sink.js | 88 + .../v2/config_service_v2.create_view.js | 76 + .../v2/config_service_v2.delete_bucket.js | 67 + .../v2/config_service_v2.delete_exclusion.js | 67 + .../v2/config_service_v2.delete_link.js | 66 + .../v2/config_service_v2.delete_sink.js | 68 + .../v2/config_service_v2.delete_view.js | 64 + .../v2/config_service_v2.get_bucket.js | 67 + .../v2/config_service_v2.get_cmek_settings.js | 71 + .../v2/config_service_v2.get_exclusion.js | 67 + .../v2/config_service_v2.get_link.js | 65 + .../v2/config_service_v2.get_settings.js | 71 + .../v2/config_service_v2.get_sink.js | 67 + .../v2/config_service_v2.get_view.js | 64 + .../v2/config_service_v2.list_buckets.js | 83 + .../v2/config_service_v2.list_exclusions.js | 80 + .../v2/config_service_v2.list_links.js | 77 + .../v2/config_service_v2.list_sinks.js | 80 + .../v2/config_service_v2.list_views.js | 77 + .../v2/config_service_v2.undelete_bucket.js | 67 + .../v2/config_service_v2.update_bucket.js | 82 + .../config_service_v2.update_bucket_async.js | 83 + .../config_service_v2.update_cmek_settings.js | 86 + .../v2/config_service_v2.update_exclusion.js | 84 + .../v2/config_service_v2.update_settings.js | 83 + .../v2/config_service_v2.update_sink.js | 101 + .../v2/config_service_v2.update_view.js | 78 + .../v2/logging_service_v2.delete_log.js | 70 + .../v2/logging_service_v2.list_log_entries.js | 106 + .../v2/logging_service_v2.list_logs.js | 94 + ..._v2.list_monitored_resource_descriptors.js | 71 + .../v2/logging_service_v2.tail_log_entries.js | 89 + .../logging_service_v2.write_log_entries.js | 129 + .../metrics_service_v2.create_log_metric.js | 69 + .../metrics_service_v2.delete_log_metric.js | 62 + .../v2/metrics_service_v2.get_log_metric.js | 62 + .../v2/metrics_service_v2.list_log_metrics.js | 77 + .../metrics_service_v2.update_log_metric.js | 70 + .../snippet_metadata_google.logging.v2.json | 1963 ++++++ owl-bot-staging/v2/src/index.ts | 29 + .../v2/src/v2/config_service_v2_client.ts | 5530 +++++++++++++++ .../v2/config_service_v2_client_config.json | 169 + .../src/v2/config_service_v2_proto_list.json | 8 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 512 ++ owl-bot-staging/v2/src/v2/index.ts | 21 + .../v2/src/v2/logging_service_v2_client.ts | 2754 ++++++++ .../v2/logging_service_v2_client_config.json | 67 + .../src/v2/logging_service_v2_proto_list.json | 8 + .../v2/src/v2/metrics_service_v2_client.ts | 2288 ++++++ .../v2/metrics_service_v2_client_config.json | 56 + .../src/v2/metrics_service_v2_proto_list.json | 8 + .../system-test/fixtures/sample/src/index.js | 29 + .../system-test/fixtures/sample/src/index.ts | 44 + owl-bot-staging/v2/system-test/install.ts | 49 + .../v2/test/gapic_config_service_v2_v2.ts | 6220 +++++++++++++++++ .../v2/test/gapic_logging_service_v2_v2.ts | 2415 +++++++ .../v2/test/gapic_metrics_service_v2_v2.ts | 2257 ++++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 + 76 files changed, 31435 insertions(+) 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/package.json create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_metrics.proto create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json create mode 100644 owl-bot-staging/v2/src/index.ts create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json 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/logging_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_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_config_service_v2_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_metrics_service_v2_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/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /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 00000000..78215349 --- /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 00000000..d4f03a0d --- /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 00000000..9e6e0612 --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/logging', + 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 00000000..1a38f257 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js new file mode 100644 index 00000000..55639e70 --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md new file mode 100644 index 00000000..bdf6f36e --- /dev/null +++ b/owl-bot-staging/v2/README.md @@ -0,0 +1 @@ +Logging: Nodejs Client diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 00000000..b670cd57 --- /dev/null +++ b/owl-bot-staging/v2/package.json @@ -0,0 +1,60 @@ +{ + "name": "@google-cloud/logging", + "version": "0.1.0", + "description": "Logging client for Node.js", + "repository": "googleapis/nodejs-logging", + "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 logging", + "logging", + "config service v2", + "logging service v2", + "metrics service v2" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto new file mode 100644 index 00000000..94c5cdff --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto @@ -0,0 +1,280 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/field_behavior.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/logging/type/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 cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; + +// An individual entry in a log. +message LogEntry { + option (google.api.resource) = { + type: "logging.googleapis.com/Log" + pattern: "projects/{project}/logs/{log}" + pattern: "organizations/{organization}/logs/{log}" + pattern: "folders/{folder}/logs/{log}" + pattern: "billingAccounts/{billing_account}/logs/{log}" + name_field: "log_name" + }; + + // Required. The resource name of the log to which this log entry belongs: + // + // "projects/[PROJECT_ID]/logs/[LOG_ID]" + // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + // "folders/[FOLDER_ID]/logs/[LOG_ID]" + // + // A project number may be used in place of PROJECT_ID. The project number is + // translated to its corresponding PROJECT_ID internally and the `log_name` + // field will contain PROJECT_ID in queries and exports. + // + // `[LOG_ID]` must be URL-encoded within `log_name`. Example: + // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + // + // `[LOG_ID]` must be less than 512 characters long and can only include the + // following characters: upper and lower case alphanumeric characters, + // forward-slash, underscore, hyphen, and period. + // + // For backward compatibility, if `log_name` begins with a forward-slash, such + // as `/projects/...`, then the log entry is ingested as usual, but the + // forward-slash is removed. Listing the log entry will not show the leading + // slash and filtering for a log name with a leading slash will never return + // any results. + string log_name = 12 [(google.api.field_behavior) = REQUIRED]; + + // Required. The monitored resource that produced this log entry. + // + // Example: a log entry that reports a database error would be associated with + // the monitored resource designating the particular database that reported + // the error. + google.api.MonitoredResource resource = 8 + [(google.api.field_behavior) = REQUIRED]; + + // The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer. Some Google + // Cloud Platform services use this field for their log entry payloads. + // + // The following protocol buffer types are supported; user-defined types + // are not supported: + // + // "type.googleapis.com/google.cloud.audit.AuditLog" + // "type.googleapis.com/google.appengine.logging.v1.RequestLog" + 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 json_payload = 6; + } + + // Optional. The time the event described by the log entry occurred. This time + // is used to compute the log entry's age and to enforce the logs retention + // period. If this field is omitted in a new log entry, then Logging assigns + // it the current time. Timestamps have nanosecond accuracy, but trailing + // zeros in the fractional seconds might be omitted when the timestamp is + // displayed. + // + // Incoming log entries must have timestamps that don't exceed the + // [logs retention + // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in + // the past, and that don't exceed 24 hours in the future. Log entries outside + // those time boundaries aren't ingested by Logging. + google.protobuf.Timestamp timestamp = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time the log entry was received by Logging. + google.protobuf.Timestamp receive_timestamp = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique identifier for the log entry. If you provide a value, + // then Logging considers other log entries in the same project, with the same + // `timestamp`, and with the same `insert_id` to be duplicates which are + // removed in a single query result. However, there are no guarantees of + // de-duplication in the export of logs. + // + // If the `insert_id` is omitted when writing a log entry, the Logging API + // assigns its own unique identifier in this field. + // + // In queries, the `insert_id` is also used to order log entries that have + // the same `log_name` and `timestamp` values. + string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information about the HTTP request associated with this log + // entry, if applicable. + google.logging.type.HttpRequest http_request = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A map of key, value pairs that provides additional information + // about the log entry. The labels can be user-defined or system-defined. + // + // User-defined labels are arbitrary key, value pairs that you can use to + // classify logs. + // + // System-defined labels are defined by GCP services for platform logs. + // They have two components - a service namespace component and the + // attribute name. For example: `compute.googleapis.com/resource_name`. + // + // Cloud Logging truncates label keys that exceed 512 B and label + // values that exceed 64 KB upon their associated log entry being + // written. The truncation is indicated by an ellipsis at the + // end of the character string. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information about an operation associated with the log entry, if + // applicable. + LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The REST resource name of the trace being written to + // [Cloud Trace](https://cloud.google.com/trace) in + // association with this log entry. For example, if your trace data is stored + // in the Cloud project "my-trace-project" and if the service that is creating + // the log entry receives a trace header that includes the trace ID "12345", + // then the service should use "projects/my-tracing-project/traces/12345". + // + // The `trace` field provides the link between logs and traces. By using + // this field, you can navigate from a log entry to a trace. + string trace = 22 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span + // associated with the current operation in which the log is being written. + // For example, if a span has the REST resource name of + // "projects/some-project/traces/some-trace/spans/some-span-id", then the + // `span_id` field is "some-span-id". + // + // A + // [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span) + // represents a single operation within a trace. Whereas a trace may involve + // multiple different microservices running on multiple different machines, + // a span generally corresponds to a single logical operation being performed + // in a single instance of a microservice on one specific machine. Spans + // are the nodes within the tree that is a trace. + // + // Applications that are [instrumented for + // tracing](https://cloud.google.com/trace/docs/setup) will generally assign a + // new, unique span ID on each incoming request. It is also common to create + // and record additional spans corresponding to internal processing elements + // as well as issuing requests to dependencies. + // + // The span ID is expected to be a 16-character, hexadecimal encoding of an + // 8-byte array and should not be zero. It should be unique within the trace + // and should, ideally, be generated in a manner that is uniformly random. + // + // Example values: + // + // - `000000000000004a` + // - `7a2190356c3fc94b` + // - `0000f00300090021` + // - `d39223e101960076` + string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The sampling decision of the trace associated with the log entry. + // + // True means that the trace resource name in the `trace` field was sampled + // for storage in a trace backend. False means that the trace was not sampled + // for storage when this log entry was written, or the sampling decision was + // unknown at the time. A non-sampled `trace` value is still useful as a + // request correlation identifier. The default is False. + bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Source code location information associated with the log entry, + // if any. + LogEntrySourceLocation source_location = 23 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information indicating this LogEntry is part of a sequence of + // multiple log entries split from a single LogEntry. + LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; +} + +// 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 [(google.api.field_behavior) = OPTIONAL]; + + // 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 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Set this to True if this is the first log entry in the operation. + bool first = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Set this to True if this is the last log entry in the operation. + bool last = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// 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 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Line within the source file. 1-based; 0 indicates no line number + // available. + int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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 [(google.api.field_behavior) = OPTIONAL]; +} + +// Additional information used to correlate multiple log entries. Used when a +// single LogEntry would exceed the Google Cloud Logging size limit and is +// split across multiple log entries. +message LogSplit { + // A globally unique identifier for all log entries in a sequence of split log + // entries. All log entries with the same |LogSplit.uid| are assumed to be + // part of the same sequence of split log entries. + string uid = 1; + + // The index of this LogEntry in the sequence of split log entries. Log + // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log + // entries. + int32 index = 2; + + // The total number of log entries that the original LogEntry was split into. + int32 total_splits = 3; +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto new file mode 100644 index 00000000..92d481ea --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto @@ -0,0 +1,483 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/logging/v2/log_entry.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LoggingProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; + +// Service for ingesting and querying logs. +service LoggingServiceV2 { + option (google.api.default_host) = "logging.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/logging.admin," + "https://www.googleapis.com/auth/logging.read," + "https://www.googleapis.com/auth/logging.write"; + + // Deletes all the log entries in a log for the _Default Log Bucket. The log + // reappears if it receives new entries. Log entries written shortly before + // the delete operation might not be deleted. Entries received after the + // delete operation with a timestamp before the operation will be deleted. + rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{log_name=projects/*/logs/*}" + additional_bindings { delete: "/v2/{log_name=*/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=organizations/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=folders/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=billingAccounts/*/logs/*}" } + }; + option (google.api.method_signature) = "log_name"; + } + + // Writes log entries to Logging. This API method is the + // only way to send log entries to Logging. This method + // is used, directly or indirectly, by the Logging agent + // (fluentd) and all logging libraries configured to use Logging. + // A single request may contain log entries for a maximum of 1000 + // different resources (projects, organizations, billing accounts or + // folders) + rpc WriteLogEntries(WriteLogEntriesRequest) + returns (WriteLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:write" + body: "*" + }; + option (google.api.method_signature) = "log_name,resource,labels,entries"; + } + + // Lists log entries. Use this method to retrieve log entries that originated + // from a project/folder/organization/billing account. For ways to export log + // entries, see [Exporting + // Logs](https://cloud.google.com/logging/docs/export). + rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:list" + body: "*" + }; + option (google.api.method_signature) = "resource_names,filter,order_by"; + } + + // Lists the descriptors for monitored resource types used by Logging. + rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) + returns (ListMonitoredResourceDescriptorsResponse) { + option (google.api.http) = { + get: "/v2/monitoredResourceDescriptors" + }; + } + + // Lists the logs in projects, organizations, folders, or billing accounts. + // Only logs that have entries are listed. + rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/logs" + additional_bindings { get: "/v2/{parent=projects/*}/logs" } + additional_bindings { get: "/v2/{parent=organizations/*}/logs" } + additional_bindings { get: "/v2/{parent=folders/*}/logs" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/logs" } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Streaming read of log entries as they are ingested. Until the stream is + // terminated, it will continue reading logs. + rpc TailLogEntries(stream TailLogEntriesRequest) + returns (stream TailLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:tail" + body: "*" + }; + } +} + +// The parameters to DeleteLog. +message DeleteLogRequest { + // Required. The resource name of the log to delete: + // + // * `projects/[PROJECT_ID]/logs/[LOG_ID]` + // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + // * `folders/[FOLDER_ID]/logs/[LOG_ID]` + // + // `[LOG_ID]` must be URL-encoded. For example, + // `"projects/my-project-id/logs/syslog"`, + // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + // + // For more information about log names, see + // [LogEntry][google.logging.v2.LogEntry]. + string log_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } + ]; +} + +// The parameters to WriteLogEntries. +message WriteLogEntriesRequest { + // Optional. A default log resource name that is assigned to all log entries + // in `entries` that do not specify a value for `log_name`: + // + // * `projects/[PROJECT_ID]/logs/[LOG_ID]` + // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + // * `folders/[FOLDER_ID]/logs/[LOG_ID]` + // + // `[LOG_ID]` must be URL-encoded. For example: + // + // "projects/my-project-id/logs/syslog" + // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + // + // The permission `logging.logEntries.create` is needed on each project, + // organization, billing account, or folder that is receiving new log + // entries, whether the resource is specified in `logName` or in an + // individual log entry. + string log_name = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } + ]; + + // Optional. A default monitored resource object that is assigned to all log + // entries in `entries` that do not specify a value for `resource`. Example: + // + // { "type": "gce_instance", + // "labels": { + // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + // + // See [LogEntry][google.logging.v2.LogEntry]. + google.api.MonitoredResource resource = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Default labels that are added to the `labels` field of all log + // entries in `entries`. If a log entry already has a label with the same key + // as a label in this parameter, then the log entry's label is not changed. + // See [LogEntry][google.logging.v2.LogEntry]. + map labels = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The log entries to send to Logging. The order of log + // entries in this list does not matter. Values supplied in this method's + // `log_name`, `resource`, and `labels` fields are copied into those log + // entries in this list that do not include values for their corresponding + // fields. For more information, see the + // [LogEntry][google.logging.v2.LogEntry] type. + // + // If the `timestamp` or `insert_id` fields are missing in log entries, then + // this method supplies the current time or a unique identifier, respectively. + // The supplied values are chosen so that, among the log entries that did not + // supply their own values, the entries earlier in the list will sort before + // the entries later in the list. See the `entries.list` method. + // + // Log entries with timestamps that are more than the + // [logs retention period](https://cloud.google.com/logging/quotas) in + // the past or more than 24 hours in the future will not be available when + // calling `entries.list`. However, those log entries can still be [exported + // with + // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + // + // To improve throughput and to avoid exceeding the + // [quota limit](https://cloud.google.com/logging/quotas) for calls to + // `entries.write`, you should try to include several log entries in this + // list, rather than calling this method for each individual log entry. + repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether a batch's valid entries should be written even if some + // other entry failed due to a permanent error such as INVALID_ARGUMENT or + // PERMISSION_DENIED. If any entry failed, then the response status is the + // response status of one of the failed entries. The response will include + // error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + // the entries' zero-based index in the `entries`. Failed requests for which + // no entries are written will not include per-entry errors. + bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the request should expect normal response, but the + // entries won't be persisted nor exported. Useful for checking whether the + // logging API endpoints are working properly before sending valuable data. + bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from WriteLogEntries. +message WriteLogEntriesResponse {} + +// Error details for WriteLogEntries with partial success. +message WriteLogEntriesPartialErrors { + // When `WriteLogEntriesRequest.partial_success` is true, records the error + // status for entries that were not written due to a permanent error, keyed + // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. + // + // Failed requests for which no entries are written will not include + // per-entry errors. + map log_entry_errors = 1; +} + +// The parameters to `ListLogEntries`. +message ListLogEntriesRequest { + // Required. Names of one or more parent resources from which to + // retrieve log entries: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // May alternatively be one or more views: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // + // Projects listed in the `project_ids` field are added to this list. + // A maximum of 100 resources may be specified in a single request. + repeated string resource_names = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. Only log entries that match the filter are returned. An empty + // filter matches all log entries in the resources listed in `resource_names`. + // Referencing a parent resource that is not listed in `resource_names` will + // cause the filter to return no results. The maximum length of a filter is + // 20,000 characters. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. How the results should be sorted. Presently, the only permitted + // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + // option returns entries in order of increasing values of + // `LogEntry.timestamp` (oldest first), and the second option returns entries + // in order of decreasing timestamps (newest first). Entries with equal + // timestamps are returned in order of their `insert_id` values. + string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Default is 50. If the value is negative or exceeds 1000, the request is + // rejected. The presence of `next_page_token` in the response indicates that + // more results might be available. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `ListLogEntries`. +message ListLogEntriesResponse { + // A list of log entries. If `entries` is empty, `nextPageToken` may still be + // returned, indicating that more entries may exist. See `nextPageToken` for + // more information. + repeated LogEntry entries = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + // + // If a value for `next_page_token` appears and the `entries` field is empty, + // it means that the search found no log entries so far but it did not have + // time to search all the possible log entries. Retry the method with this + // value for `page_token` to continue the search. Alternatively, consider + // speeding up the search by changing your filter to specify a single log name + // or resource type, or to narrow the time range of the search. + string next_page_token = 2; +} + +// The parameters to ListMonitoredResourceDescriptors +message ListMonitoredResourceDescriptorsRequest { + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListMonitoredResourceDescriptors. +message ListMonitoredResourceDescriptorsResponse { + // A list of resource descriptors. + repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to ListLogs. +message ListLogsRequest { + // Required. The resource name to list logs for: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. List of resource names to list logs for: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // + // To support legacy queries, it could also be: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // The resource name in the `parent` field is added to this list. + repeated string resource_names = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListLogs. +message ListLogsResponse { + // A list of log names. For example, + // `"projects/my-project/logs/syslog"` or + // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + repeated string log_names = 3; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `TailLogEntries`. +message TailLogEntriesRequest { + // Required. Name of a parent resource from which to retrieve log entries: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // May alternatively be one or more views: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Only log entries that match the filter are returned. An empty + // filter matches all log entries in the resources listed in `resource_names`. + // Referencing a parent resource that is not listed in `resource_names` will + // cause the filter to return no results. The maximum length of a filter is + // 20,000 characters. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The amount of time to buffer log entries at the server before + // being returned to prevent out of order results due to late arriving log + // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 + // milliseconds. + google.protobuf.Duration buffer_window = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `TailLogEntries`. +message TailLogEntriesResponse { + // Information about entries that were omitted from the session. + message SuppressionInfo { + // An indicator of why entries were omitted. + enum Reason { + // Unexpected default. + REASON_UNSPECIFIED = 0; + + // Indicates suppression occurred due to relevant entries being + // received in excess of rate limits. For quotas and limits, see + // [Logging API quotas and + // limits](https://cloud.google.com/logging/quotas#api-limits). + RATE_LIMIT = 1; + + // Indicates suppression occurred due to the client not consuming + // responses quickly enough. + NOT_CONSUMED = 2; + } + + // The reason that entries were omitted from the session. + Reason reason = 1; + + // A lower bound on the count of entries omitted due to `reason`. + int32 suppressed_count = 2; + } + + // A list of log entries. Each response in the stream will order entries with + // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed + // between separate responses. + repeated LogEntry entries = 1; + + // If entries that otherwise would have been included in the session were not + // sent back to the client, counts of relevant entries omitted from the + // session with the reason that they were not included. There will be at most + // one of each reason per response. The counts represent the number of + // suppressed entries since the last streamed response. + repeated SuppressionInfo suppression_info = 2; +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto new file mode 100644 index 00000000..cc7677b1 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto @@ -0,0 +1,2317 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LoggingConfigProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/OrganizationLocation" + pattern: "organizations/{organization}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/FolderLocation" + pattern: "folders/{folder}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/BillingAccountLocation" + pattern: "billingAccounts/{billing_account}/locations/{location}" +}; + +// Service for configuring sinks used to route log entries. +service ConfigServiceV2 { + option (google.api.default_host) = "logging.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/logging.admin," + "https://www.googleapis.com/auth/logging.read"; + + // Lists log buckets. + rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*}/buckets" + additional_bindings { get: "/v2/{parent=projects/*/locations/*}/buckets" } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/buckets" + } + additional_bindings { get: "/v2/{parent=folders/*/locations/*}/buckets" } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a log bucket. + rpc GetBucket(GetBucketRequest) returns (LogBucket) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*}" + additional_bindings { get: "/v2/{name=projects/*/locations/*/buckets/*}" } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*}" + } + additional_bindings { get: "/v2/{name=folders/*/locations/*/buckets/*}" } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + } + }; + } + + // Creates a log bucket asynchronously that can be used to store log entries. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc CreateBucketAsync(CreateBucketRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*}/buckets:createAsync" + body: "bucket" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync" + body: "bucket" + } + }; + option (google.longrunning.operation_info) = { + response_type: "LogBucket" + metadata_type: "BucketMetadata" + }; + } + + // Updates a log bucket asynchronously. + // + // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + // `FAILED_PRECONDITION` will be returned. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc UpdateBucketAsync(UpdateBucketRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=*/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=folders/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + }; + option (google.longrunning.operation_info) = { + response_type: "LogBucket" + metadata_type: "BucketMetadata" + }; + } + + // Creates a log bucket that can be used to store log entries. After a bucket + // has been created, the bucket's location cannot be changed. + rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*}/buckets" + body: "bucket" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" + body: "bucket" + } + }; + } + + // Updates a log bucket. + // + // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + // `FAILED_PRECONDITION` will be returned. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { + option (google.api.http) = { + patch: "/v2/{name=*/*/locations/*/buckets/*}" + body: "bucket" + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=folders/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + body: "bucket" + } + }; + } + + // Deletes a log bucket. + // + // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. + // After 7 days, the bucket will be purged and all log entries in the bucket + // will be permanently deleted. + rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + } + }; + } + + // Undeletes a log bucket. A bucket that has been deleted can be undeleted + // within the grace period of 7 days. + rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" + body: "*" + } + }; + } + + // Lists views on a log bucket. + rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*/buckets/*}/views" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a view on a log bucket.. + rpc GetView(GetViewRequest) returns (LogView) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + } + }; + } + + // Creates a view over log entries in a log bucket. A bucket may contain a + // maximum of 30 views. + rpc CreateView(CreateViewRequest) returns (LogView) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*/buckets/*}/views" + body: "view" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" + body: "view" + } + }; + } + + // Updates a view on a log bucket. This method replaces the following fields + // in the existing view with values from the new view: `filter`. + // If an `UNAVAILABLE` error is returned, this indicates that system is not in + // a state where it can update the view. If this occurs, please try again in a + // few minutes. + rpc UpdateView(UpdateViewRequest) returns (LogView) { + option (google.api.http) = { + patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + body: "view" + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + body: "view" + } + }; + } + + // Deletes a view on a log bucket. + // If an `UNAVAILABLE` error is returned, this indicates that system is not in + // a state where it can delete the view. If this occurs, please try again in a + // few minutes. + rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + } + }; + } + + // Lists sinks. + rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/sinks" + additional_bindings { get: "/v2/{parent=projects/*}/sinks" } + additional_bindings { get: "/v2/{parent=organizations/*}/sinks" } + additional_bindings { get: "/v2/{parent=folders/*}/sinks" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/sinks" } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a sink. + rpc GetSink(GetSinkRequest) returns (LogSink) { + option (google.api.http) = { + get: "/v2/{sink_name=*/*/sinks/*}" + additional_bindings { get: "/v2/{sink_name=projects/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=organizations/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=folders/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=billingAccounts/*/sinks/*}" } + }; + option (google.api.method_signature) = "sink_name"; + } + + // Creates a sink that exports specified log entries to a destination. The + // export of newly-ingested log entries begins immediately, unless the sink's + // `writer_identity` is not permitted to write to the destination. A sink can + // export log entries only from the resource owning the sink. + rpc CreateSink(CreateSinkRequest) returns (LogSink) { + option (google.api.http) = { + post: "/v2/{parent=*/*}/sinks" + body: "sink" + additional_bindings { post: "/v2/{parent=projects/*}/sinks" body: "sink" } + additional_bindings { + post: "/v2/{parent=organizations/*}/sinks" + body: "sink" + } + additional_bindings { post: "/v2/{parent=folders/*}/sinks" body: "sink" } + additional_bindings { + post: "/v2/{parent=billingAccounts/*}/sinks" + body: "sink" + } + }; + option (google.api.method_signature) = "parent,sink"; + } + + // Updates a sink. This method replaces the following fields in the existing + // sink with values from the new sink: `destination`, and `filter`. + // + // The updated sink might also have a new `writer_identity`; see the + // `unique_writer_identity` field. + rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { + option (google.api.http) = { + put: "/v2/{sink_name=*/*/sinks/*}" + body: "sink" + additional_bindings { + put: "/v2/{sink_name=projects/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=organizations/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=folders/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=billingAccounts/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=projects/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=organizations/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=folders/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" + body: "sink" + } + }; + option (google.api.method_signature) = "sink_name,sink,update_mask"; + option (google.api.method_signature) = "sink_name,sink"; + } + + // Deletes a sink. If the sink has a unique `writer_identity`, then that + // service account is also deleted. + rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{sink_name=*/*/sinks/*}" + additional_bindings { delete: "/v2/{sink_name=projects/*/sinks/*}" } + additional_bindings { delete: "/v2/{sink_name=organizations/*/sinks/*}" } + additional_bindings { delete: "/v2/{sink_name=folders/*/sinks/*}" } + additional_bindings { + delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" + } + }; + option (google.api.method_signature) = "sink_name"; + } + + // Asynchronously creates a linked dataset in BigQuery which makes it possible + // to use BigQuery to read the logs stored in the log bucket. A log bucket may + // currently only contain one link. + rpc CreateLink(CreateLinkRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*/buckets/*}/links" + body: "link" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" + body: "link" + } + }; + option (google.api.method_signature) = "parent,link,link_id"; + option (google.longrunning.operation_info) = { + response_type: "Link" + metadata_type: "LinkMetadata" + }; + } + + // Deletes a link. This will also delete the corresponding BigQuery linked + // dataset. + rpc DeleteLink(DeleteLinkRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*/links/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "LinkMetadata" + }; + } + + // Lists links. + rpc ListLinks(ListLinksRequest) returns (ListLinksResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*/buckets/*}/links" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a link. + rpc GetLink(GetLinkRequest) returns (Link) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*/links/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the exclusions on the _Default sink in a parent resource. + rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/exclusions" + additional_bindings { get: "/v2/{parent=projects/*}/exclusions" } + additional_bindings { get: "/v2/{parent=organizations/*}/exclusions" } + additional_bindings { get: "/v2/{parent=folders/*}/exclusions" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/exclusions" } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the description of an exclusion in the _Default sink. + rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + get: "/v2/{name=*/*/exclusions/*}" + additional_bindings { get: "/v2/{name=projects/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=organizations/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=folders/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=billingAccounts/*/exclusions/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new exclusion in the _Default sink in a specified parent + // resource. Only log entries belonging to that resource can be excluded. You + // can have up to 10 exclusions in a resource. + rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + post: "/v2/{parent=*/*}/exclusions" + body: "exclusion" + additional_bindings { + post: "/v2/{parent=projects/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=organizations/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=folders/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*}/exclusions" + body: "exclusion" + } + }; + option (google.api.method_signature) = "parent,exclusion"; + } + + // Changes one or more properties of an existing exclusion in the _Default + // sink. + rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + patch: "/v2/{name=*/*/exclusions/*}" + body: "exclusion" + additional_bindings { + patch: "/v2/{name=projects/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=organizations/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=folders/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/exclusions/*}" + body: "exclusion" + } + }; + option (google.api.method_signature) = "name,exclusion,update_mask"; + } + + // Deletes an exclusion in the _Default sink. + rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/exclusions/*}" + additional_bindings { delete: "/v2/{name=projects/*/exclusions/*}" } + additional_bindings { delete: "/v2/{name=organizations/*/exclusions/*}" } + additional_bindings { delete: "/v2/{name=folders/*/exclusions/*}" } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/exclusions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Gets the Logging CMEK settings for the given resource. + // + // Note: CMEK for the Log Router can be configured for Google Cloud projects, + // folders, organizations and billing accounts. Once configured for an + // organization, it applies to all projects and folders in the Google Cloud + // organization. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { + option (google.api.http) = { + get: "/v2/{name=*/*}/cmekSettings" + additional_bindings { get: "/v2/{name=projects/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=organizations/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=folders/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=billingAccounts/*}/cmekSettings" } + }; + } + + // Updates the Log Router CMEK settings for the given resource. + // + // Note: CMEK for the Log Router can currently only be configured for Google + // Cloud organizations. Once configured, it applies to all projects and + // folders in the Google Cloud organization. + // + // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] + // will fail if 1) `kms_key_name` is invalid, or 2) the associated service + // account does not have the required + // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + // 3) access to the key is disabled. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { + option (google.api.http) = { + patch: "/v2/{name=*/*}/cmekSettings" + body: "cmek_settings" + additional_bindings { + patch: "/v2/{name=organizations/*}/cmekSettings" + body: "cmek_settings" + } + }; + } + + // Gets the Log Router settings for the given resource. + // + // Note: Settings for the Log Router can be get for Google Cloud projects, + // folders, organizations and billing accounts. Currently it can only be + // configured for organizations. Once configured for an organization, it + // applies to all projects and folders in the Google Cloud organization. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc GetSettings(GetSettingsRequest) returns (Settings) { + option (google.api.http) = { + get: "/v2/{name=*/*}/settings" + additional_bindings { get: "/v2/{name=projects/*}/settings" } + additional_bindings { get: "/v2/{name=organizations/*}/settings" } + additional_bindings { get: "/v2/{name=folders/*}/settings" } + additional_bindings { get: "/v2/{name=billingAccounts/*}/settings" } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the Log Router settings for the given resource. + // + // Note: Settings for the Log Router can currently only be configured for + // Google Cloud organizations. Once configured, it applies to all projects and + // folders in the Google Cloud organization. + // + // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] + // will fail if 1) `kms_key_name` is invalid, or 2) the associated service + // account does not have the required + // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + // 3) access to the key is disabled. 4) `location_id` is not supported by + // Logging. 5) `location_id` violate OrgPolicy. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { + option (google.api.http) = { + patch: "/v2/{name=*/*}/settings" + body: "settings" + additional_bindings { + patch: "/v2/{name=organizations/*}/settings" + body: "settings" + } + additional_bindings { + patch: "/v2/{name=folders/*}/settings" + body: "settings" + } + }; + option (google.api.method_signature) = "settings,update_mask"; + } + + // Copies a set of log entries from a log bucket to a Cloud Storage bucket. + rpc CopyLogEntries(CopyLogEntriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/entries:copy" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "CopyLogEntriesResponse" + metadata_type: "CopyLogEntriesMetadata" + }; + } +} + +// Configuration for an indexed field. +message IndexConfig { + // Required. The LogEntry field path to index. + // + // Note that some paths are automatically indexed, and other paths are not + // eligible for indexing. See [indexing documentation]( + // https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields) + // for details. + // + // For example: `jsonPayload.request.status` + string field_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of data in this index. + IndexType type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The timestamp when the index was last modified. + // + // This is used to return the timestamp, and will be ignored if supplied + // during update. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a repository in which log entries are stored. +message LogBucket { + option (google.api.resource) = { + type: "logging.googleapis.com/LogBucket" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" + }; + + // Output only. The resource name of the bucket. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket` + // + // For a list of supported locations, see [Supported + // Regions](https://cloud.google.com/logging/docs/region-support) + // + // For the location of `global` it is unspecified where log entries are + // actually stored. + // + // After a bucket has been created, the location cannot be changed. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Describes this bucket. + string description = 3; + + // Output only. The creation timestamp of the bucket. This is not set for any + // of the default buckets. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the bucket. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Logs will be retained by default for this amount of time, after which they + // will automatically be deleted. The minimum retention period is 1 day. If + // this value is set to zero at bucket creation time, the default time of 30 + // days will be used. + int32 retention_days = 11; + + // Whether the bucket is locked. + // + // The retention period on a locked bucket cannot be changed. Locked buckets + // may only be deleted if they are empty. + bool locked = 9; + + // Output only. The bucket lifecycle state. + LifecycleState lifecycle_state = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether log analytics is enabled for this bucket. + // + // Once enabled, log analytics features cannot be disabled. + bool analytics_enabled = 14; + + // Log entry field paths that are denied access in this bucket. + // + // The following fields and their children are eligible: `textPayload`, + // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. + // + // Restricting a repeated field will restrict all values. Adding a parent will + // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) + repeated string restricted_fields = 15; + + // A list of indexed fields and related configuration data. + repeated IndexConfig index_configs = 17; + + // The CMEK settings of the log bucket. If present, new log entries written to + // this log bucket are encrypted using the CMEK key provided in this + // configuration. If a log bucket has CMEK settings, the CMEK settings cannot + // be disabled later by updating the log bucket. Changing the KMS key is + // allowed. + CmekSettings cmek_settings = 19; +} + +// Describes a view over log entries in a bucket. +message LogView { + option (google.api.resource) = { + type: "logging.googleapis.com/LogView" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" + }; + + // The resource name of the view. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` + string name = 1; + + // Describes this view. + string description = 3; + + // Output only. The creation timestamp of the view. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the view. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Filter that restricts which log entries in a bucket are visible in this + // view. + // + // Filters are restricted to be a logical AND of ==/!= of any of the + // following: + // + // - originating project/folder/organization/billing account. + // - resource type + // - log id + // + // For example: + // + // SOURCE("projects/myproject") AND resource.type = "gce_instance" + // AND LOG_ID("stdout") + string filter = 7; +} + +// Describes a sink used to export log entries to one of the following +// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a +// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log +// entries are exported. The sink must be created within a project, +// organization, billing account, or folder. +message LogSink { + option (google.api.resource) = { + type: "logging.googleapis.com/LogSink" + pattern: "projects/{project}/sinks/{sink}" + pattern: "organizations/{organization}/sinks/{sink}" + pattern: "folders/{folder}/sinks/{sink}" + pattern: "billingAccounts/{billing_account}/sinks/{sink}" + }; + + // Deprecated. This is unused. + enum VersionFormat { + // An unspecified format version that will default to V2. + VERSION_FORMAT_UNSPECIFIED = 0; + + // `LogEntry` version 2 format. + V2 = 1; + + // `LogEntry` version 1 format. + V1 = 2; + } + + // Required. The client-assigned sink identifier, unique within the project. + // + // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited + // to 100 characters and can include only the following characters: upper and + // lower-case alphanumeric characters, underscores, hyphens, and periods. + // First character has to be alphanumeric. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The export destination: + // + // "storage.googleapis.com/[GCS_BUCKET]" + // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" + // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" + // + // The sink's `writer_identity`, set when the sink is created, must have + // permission to write to the destination or else the log entries are not + // exported. For more information, see + // [Exporting Logs with + // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + string destination = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Optional. An [advanced logs + // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The + // only exported log entries are those that are in the resource owning the + // sink and that match the filter. + // + // For example: + // + // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A description of this sink. + // + // The maximum length of the description is 8000 characters. + string description = 18 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, then this sink is disabled and it does not export + // any log entries. + bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Log entries that match any of these exclusion filters will not be + // exported. + // + // If a log entry is matched by both `filter` and one of `exclusion_filters` + // it will not be exported. + repeated LogExclusion exclusions = 16 + [(google.api.field_behavior) = OPTIONAL]; + + // Deprecated. This field is unused. + VersionFormat output_version_format = 6 [deprecated = true]; + + // Output only. An IAM identity—a service account or group—under + // which Cloud Logging writes the exported log entries to the sink's + // destination. This field is either set by specifying + // `custom_writer_identity` or set automatically by + // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and + // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the + // value of `unique_writer_identity` in those methods. + // + // Until you grant this identity write-access to the destination, log entry + // exports from this sink will fail. For more information, see [Granting + // Access for a + // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). + // Consult the destination service's documentation to determine the + // appropriate IAM roles to assign to the identity. + // + // Sinks that have a destination that is a log bucket in the same project as + // the sink cannot have a writer_identity and no additional permissions are + // required. + string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. This field applies only to sinks owned by organizations and + // folders. If the field is false, the default, only the logs owned by the + // sink's parent resource are available for export. If the field is true, then + // log entries from all the projects, folders, and billing accounts contained + // in the sink's parent resource are also available for export. Whether a + // particular log entry from the children is exported depends on the sink's + // filter expression. + // + // For example, if this field is true, then the filter + // `resource.type=gce_instance` would export all Compute Engine VM instance + // log entries from all projects in the sink's parent. + // + // To only export entries from certain child projects, filter on the project + // part of the log name: + // + // logName:("projects/test-project1/" OR "projects/test-project2/") AND + // resource.type=gce_instance + bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Destination dependent options. + oneof options { + // Optional. Options that affect sinks exporting data to BigQuery. + BigQueryOptions bigquery_options = 12 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The creation timestamp of the sink. + // + // This field may not be present for older sinks. + google.protobuf.Timestamp create_time = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the sink. + // + // This field may not be present for older sinks. + google.protobuf.Timestamp update_time = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a BigQuery dataset that was created by a link. +message BigQueryDataset { + // Output only. The full resource name of the BigQuery dataset. The DATASET_ID + // will match the ID of the link, so the link must match the naming + // restrictions of BigQuery datasets (alphanumeric characters and underscores + // only). + // + // The dataset will have a resource path of + // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]" + string dataset_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a link connected to an analytics enabled bucket. +message Link { + option (google.api.resource) = { + type: "logging.googleapis.com/Link" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}" + }; + + // The resource name of the link. The name can have up to 100 characters. + // A valid link id (at the end of the link name) must only have alphanumeric + // characters and underscores within it. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket/links/my_link + string name = 1; + + // Describes this link. + // + // The maximum length of the description is 8000 characters. + string description = 2; + + // Output only. The creation timestamp of the link. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The resource lifecycle state. + LifecycleState lifecycle_state = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The information of a BigQuery Dataset. When a link is created, a BigQuery + // dataset is created along with it, in the same project as the LogBucket it's + // linked to. This dataset will also have BigQuery Views corresponding to the + // LogViews in the bucket. + BigQueryDataset bigquery_dataset = 5; +} + +// Options that change functionality of a sink exporting data to BigQuery. +message BigQueryOptions { + // Optional. Whether to use [BigQuery's partition + // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By + // default, Cloud Logging creates dated tables based on the log entries' + // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix + // is no longer present and [special query + // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) + // has to be used instead. In both cases, tables are sharded based on UTC + // timezone. + bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. True if new timestamp column based partitioning is in use, + // false if legacy ingestion-time partitioning is in use. + // + // All new sinks will have this field set true and will use timestamp column + // based partitioning. If use_partitioned_tables is false, this value has no + // meaning and will be false. Legacy sinks using partitioned tables will have + // this field set to false. + bool uses_timestamp_column_partitioning = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The parameters to `ListBuckets`. +message ListBucketsRequest { + // Required. The parent resource whose buckets are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + // + // Note: The locations portion of the resource must be specified, but + // supplying the character `-` in place of [LOCATION_ID] will return all + // buckets. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogBucket" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListBuckets. +message ListBucketsResponse { + // A list of buckets. + repeated LogBucket buckets = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `CreateBucket`. +message CreateBucketRequest { + // Required. The resource in which to create the log bucket: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + // + // For example: + // + // `"projects/my-project/locations/global"` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogBucket" + } + ]; + + // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + // are limited to 100 characters and can include only letters, digits, + // underscores, hyphens, and periods. + string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new bucket. The region specified in the new bucket must be + // compliant with any Location Restriction Org Policy. The name field in the + // bucket is ignored. + LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `UpdateBucket`. +message UpdateBucketRequest { + // Required. The full resource name of the bucket to update. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; + + // Required. The updated bucket. + LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask that specifies the fields in `bucket` that need an + // update. A bucket field will be overwritten if, and only if, it is in the + // update mask. `name` and output only fields cannot be updated. + // + // For a detailed `FieldMask` definition, see: + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=retention_days` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `GetBucket`. +message GetBucketRequest { + // Required. The resource name of the bucket: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `DeleteBucket`. +message DeleteBucketRequest { + // Required. The full resource name of the bucket to delete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `UndeleteBucket`. +message UndeleteBucketRequest { + // Required. The full resource name of the bucket to undelete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `ListViews`. +message ListViewsRequest { + // Required. The bucket whose views are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListViews. +message ListViewsResponse { + // A list of views. + repeated LogView views = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `CreateView`. +message CreateViewRequest { + // Required. The bucket in which to create the view + // + // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client-assigned identifier such as `"my-view"`. Identifiers are + // limited to 100 characters and can include only letters, digits, + // underscores, hyphens, and periods. + string view_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new view. + LogView view = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `UpdateView`. +message UpdateViewRequest { + // Required. The full resource name of the view to update + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The updated view. + LogView view = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Field mask that specifies the fields in `view` that need + // an update. A field will be overwritten if, and only if, it is + // in the update mask. `name` and output only fields cannot be updated. + // + // For a detailed `FieldMask` definition, see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=filter` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `GetView`. +message GetViewRequest { + // Required. The resource name of the policy: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } + ]; +} + +// The parameters to `DeleteView`. +message DeleteViewRequest { + // Required. The full resource name of the view to delete: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } + ]; +} + +// The parameters to `ListSinks`. +message ListSinksRequest { + // Required. The parent resource whose sinks are to be listed: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogSink" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `ListSinks`. +message ListSinksResponse { + // A list of sinks. + repeated LogSink sinks = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `GetSink`. +message GetSinkRequest { + // Required. The resource name of the sink: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; +} + +// The parameters to `CreateSink`. +message CreateSinkRequest { + // Required. The resource in which to create the sink: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + // + // For examples: + // + // `"projects/my-project"` + // `"organizations/123456789"` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogSink" + } + ]; + + // Required. The new sink, whose `name` parameter is a sink identifier that + // is not already in use. + LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Determines the kind of IAM identity returned as `writer_identity` + // in the new sink. If this value is omitted or set to false, and if the + // sink's parent is a project, then the value returned as `writer_identity` is + // the same group or service account used by Cloud Logging before the addition + // of writer identities to this API. The sink's destination must be in the + // same project as the sink itself. + // + // If this field is set to true, or if the sink is owned by a non-project + // resource such as an organization, then the value of `writer_identity` will + // be a unique service account used only for exports from the new sink. For + // more information, see `writer_identity` in + // [LogSink][google.logging.v2.LogSink]. + bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `UpdateSink`. +message UpdateSinkRequest { + // Required. The full resource name of the sink to update, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; + + // Required. The updated sink, whose name is the same identifier that appears + // as part of `sink_name`. + LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] + // for a description of this field. When updating a sink, the effect of this + // field on the value of `writer_identity` in the updated sink depends on both + // the old and new values of this field: + // + // + If the old and new values of this field are both false or both true, + // then there is no change to the sink's `writer_identity`. + // + If the old value is false and the new value is true, then + // `writer_identity` is changed to a unique service account. + // + It is an error if the old value is true and the new value is + // set to false or defaulted to false. + bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Field mask that specifies the fields in `sink` that need + // an update. A sink field will be overwritten if, and only if, it is + // in the update mask. `name` and output only fields cannot be updated. + // + // An empty `updateMask` is temporarily treated as using the following mask + // for backwards compatibility purposes: + // + // `destination,filter,includeChildren` + // + // At some point in the future, behavior will be removed and specifying an + // empty `updateMask` will be an error. + // + // For a detailed `FieldMask` definition, see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=filter` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `DeleteSink`. +message DeleteSinkRequest { + // Required. The full resource name of the sink to delete, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; +} + +// The parameters to CreateLink. +message CreateLinkRequest { + // Required. The full resource name of the bucket to create a link for. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Link" + } + ]; + + // Required. The new link. + Link link = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the link. The link_id can have up to 100 + // characters. A valid link_id must only have alphanumeric characters and + // underscores within it. + string link_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to DeleteLink. +message DeleteLinkRequest { + // Required. The full resource name of the link to delete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } + ]; +} + +// The parameters to ListLinks. +message ListLinksRequest { + // Required. The parent resource whose links are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Link" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListLinks. +message ListLinksResponse { + // A list of links. + repeated Link links = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to GetLink. +message GetLinkRequest { + // Required. The resource name of the link: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } + ]; +} + +// Specifies a set of log entries that are filtered out by a sink. If +// your Google Cloud resource receives a large volume of log entries, you can +// use exclusions to reduce your chargeable logs. Note that exclusions on +// organization-level and folder-level sinks don't apply to child resources. +// Note also that you cannot modify the _Required sink or exclude logs from it. +message LogExclusion { + option (google.api.resource) = { + type: "logging.googleapis.com/LogExclusion" + pattern: "projects/{project}/exclusions/{exclusion}" + pattern: "organizations/{organization}/exclusions/{exclusion}" + pattern: "folders/{folder}/exclusions/{exclusion}" + pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" + }; + + // Required. A client-assigned identifier, such as + // `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and + // can include only letters, digits, underscores, hyphens, and periods. First + // character has to be alphanumeric. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A description of this exclusion. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. An [advanced logs + // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that + // matches the log entries to be excluded. By using the [sample + // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), + // you can exclude less than 100% of the matching log entries. + // + // For example, the following query matches 99% of low-severity log entries + // from Google Cloud Storage buckets: + // + // `resource.type=gcs_bucket severity=ERROR" + // + // The maximum length of the filter is 20000 characters. + string filter = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The resource name of the Log Bucket that owns the Log Metric. + // Only Log Buckets in projects are supported. The bucket has to be in the + // same project as the metric. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket` + // + // If empty, then the Log Metric is considered a non-Bucket Log Metric. + string bucket_name = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to True, then this metric is disabled and it does not + // generate any points. + bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The metric descriptor associated with the logs-based metric. + // If unspecified, it uses a default metric descriptor with a DELTA metric + // kind, INT64 value type, with no labels and a unit of "1". Such a metric + // counts the number of log entries matching the `filter` expression. + // + // The `name`, `type`, and `description` fields in the `metric_descriptor` + // are output only, and is constructed using the `name` and `description` + // field in the LogMetric. + // + // To create a logs-based metric that records a distribution of log values, a + // DELTA metric kind with a DISTRIBUTION value type must be used along with + // a `value_extractor` expression in the LogMetric. + // + // Each label in the metric descriptor must have a matching label + // name as the key and an extractor expression as the value in the + // `label_extractors` map. + // + // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot + // be updated once initially configured. New labels can be added in the + // `metric_descriptor`, but existing labels cannot be modified except for + // their description. + google.api.MetricDescriptor metric_descriptor = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A `value_extractor` is required when using a distribution + // logs-based metric to extract the values to record from a log entry. + // Two functions are supported for value extraction: `EXTRACT(field)` or + // `REGEXP_EXTRACT(field, regex)`. The arguments are: + // + // 1. field: The name of the log entry field from which the value is to be + // extracted. + // 2. regex: A regular expression using the Google RE2 syntax + // (https://github.com/google/re2/wiki/Syntax) with a single capture + // group to extract data from the specified log entry field. The value + // of the field is converted to a string before applying the regex. + // It is an error to specify a regex that does not include exactly one + // capture group. + // + // The result of the extraction must be convertible to a double type, as the + // distribution always records double values. If either the extraction or + // the conversion to double fails, then those values are not recorded in the + // distribution. + // + // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` + string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A map from a label key string to an extractor expression which is + // used to extract data from a log entry field and assign as the label value. + // Each label key specified in the LabelDescriptor must have an associated + // extractor expression in this map. The syntax of the extractor expression + // is the same as for the `value_extractor` field. + // + // The extracted value is converted to the type defined in the label + // descriptor. If either the extraction or the type conversion fails, + // the label will have a default value. The default value for a string + // label is an empty string, for an integer label its 0, and for a boolean + // label its `false`. + // + // Note that there are upper bounds on the maximum number of labels and the + // number of active time series that are allowed in a project. + map label_extractors = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `bucket_options` are required when the logs-based metric is + // using a DISTRIBUTION value type and it describes the bucket boundaries + // used to create a histogram of the extracted values. + google.api.Distribution.BucketOptions bucket_options = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The creation timestamp of the metric. + // + // This field may not be present for older metrics. + google.protobuf.Timestamp create_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the metric. + // + // This field may not be present for older metrics. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Deprecated. The API version that created or updated this metric. + // The v2 format is used by default and cannot be changed. + ApiVersion version = 4 [deprecated = true]; +} + +// The parameters to ListLogMetrics. +message ListLogMetricsRequest { + // Required. The name of the project containing the metrics: + // + // "projects/[PROJECT_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListLogMetrics. +message ListLogMetricsResponse { + // A list of logs-based metrics. + repeated LogMetric metrics = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to GetLogMetric. +message GetLogMetricRequest { + // Required. The resource name of the desired metric: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; +} + +// The parameters to CreateLogMetric. +message CreateLogMetricRequest { + // Required. The resource name of the project in which to create the metric: + // + // "projects/[PROJECT_ID]" + // + // The new metric must be provided in the request. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogMetric" + } + ]; + + // Required. The new logs-based metric, which must not have an identifier that + // already exists. + LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to UpdateLogMetric. +message UpdateLogMetricRequest { + // Required. The resource name of the metric to update: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + // + // The updated metric must be provided in the request and it's + // `name` field must be the same as `[METRIC_ID]` If the metric + // does not exist in `[PROJECT_ID]`, then a new metric is created. + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; + + // Required. The updated metric. + LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to DeleteLogMetric. +message DeleteLogMetricRequest { + // Required. The resource name of the metric to delete: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; +} diff --git a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js new file mode 100644 index 00000000..23bfc32a --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, destination) { + // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Log bucket from which to copy log entries. + * For example: + * `"projects/my-project/locations/global/buckets/my-source-bucket"` + */ + // const name = 'abc123' + /** + * Optional. A filter specifying which log entries to copy. The filter must be + * no more than 20k characters. An empty filter matches all log entries. + */ + // const filter = 'abc123' + /** + * Required. Destination to which to copy log entries. + */ + // const destination = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCopyLogEntries() { + // Construct request + const request = { + name, + destination, + }; + + // Run request + const [operation] = await loggingClient.copyLogEntries(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCopyLogEntries(); + // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_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/config_service_v2.create_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js new file mode 100644 index 00000000..1de575fc --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bucketId, bucket) { + // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the log bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * For example: + * `"projects/my-project/locations/global"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const bucketId = 'abc123' + /** + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + */ + // const bucket = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateBucket() { + // Construct request + const request = { + parent, + bucketId, + bucket, + }; + + // Run request + const response = await loggingClient.createBucket(request); + console.log(response); + } + + callCreateBucket(); + // [END logging_v2_generated_ConfigServiceV2_CreateBucket_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/config_service_v2.create_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js new file mode 100644 index 00000000..864ee229 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js @@ -0,0 +1,79 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bucketId, bucket) { + // [START logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the log bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * For example: + * `"projects/my-project/locations/global"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const bucketId = 'abc123' + /** + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + */ + // const bucket = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateBucketAsync() { + // Construct request + const request = { + parent, + bucketId, + bucket, + }; + + // Run request + const [operation] = await loggingClient.createBucketAsync(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBucketAsync(); + // [END logging_v2_generated_ConfigServiceV2_CreateBucketAsync_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/config_service_v2.create_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js new file mode 100644 index 00000000..e2fa1898 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, exclusion) { + // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource in which to create the exclusion: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * For examples: + * `"projects/my-logging-project"` + * `"organizations/123456789"` + */ + // const parent = 'abc123' + /** + * Required. The new exclusion, whose `name` parameter is an exclusion name + * that is not already used in the parent resource. + */ + // const exclusion = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateExclusion() { + // Construct request + const request = { + parent, + exclusion, + }; + + // Run request + const response = await loggingClient.createExclusion(request); + console.log(response); + } + + callCreateExclusion(); + // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_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/config_service_v2.create_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js new file mode 100644 index 00000000..56e3e2ad --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, link, linkId) { + // [START logging_v2_generated_ConfigServiceV2_CreateLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to create a link for. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + */ + // const parent = 'abc123' + /** + * Required. The new link. + */ + // const link = {} + /** + * Required. The ID to use for the link. The link_id can have up to 100 + * characters. A valid link_id must only have alphanumeric characters and + * underscores within it. + */ + // const linkId = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateLink() { + // Construct request + const request = { + parent, + link, + linkId, + }; + + // Run request + const [operation] = await loggingClient.createLink(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateLink(); + // [END logging_v2_generated_ConfigServiceV2_CreateLink_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/config_service_v2.create_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js new file mode 100644 index 00000000..46f64094 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js @@ -0,0 +1,88 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, sink) { + // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the sink: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * For examples: + * `"projects/my-project"` + * `"organizations/123456789"` + */ + // const parent = 'abc123' + /** + * Required. The new sink, whose `name` parameter is a sink identifier that + * is not already in use. + */ + // const sink = {} + /** + * Optional. Determines the kind of IAM identity returned as `writer_identity` + * in the new sink. If this value is omitted or set to false, and if the + * sink's parent is a project, then the value returned as `writer_identity` is + * the same group or service account used by Cloud Logging before the addition + * of writer identities to this API. The sink's destination must be in the + * same project as the sink itself. + * If this field is set to true, or if the sink is owned by a non-project + * resource such as an organization, then the value of `writer_identity` will + * be a unique service account used only for exports from the new sink. For + * more information, see `writer_identity` in + * LogSink google.logging.v2.LogSink. + */ + // const uniqueWriterIdentity = true + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateSink() { + // Construct request + const request = { + parent, + sink, + }; + + // Run request + const response = await loggingClient.createSink(request); + console.log(response); + } + + callCreateSink(); + // [END logging_v2_generated_ConfigServiceV2_CreateSink_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/config_service_v2.create_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js new file mode 100644 index 00000000..1d598493 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, viewId, view) { + // [START logging_v2_generated_ConfigServiceV2_CreateView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The bucket in which to create the view + * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-view"`. Identifiers are + * limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const viewId = 'abc123' + /** + * Required. The new view. + */ + // const view = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateView() { + // Construct request + const request = { + parent, + viewId, + view, + }; + + // Run request + const response = await loggingClient.createView(request); + console.log(response); + } + + callCreateView(); + // [END logging_v2_generated_ConfigServiceV2_CreateView_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/config_service_v2.delete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js new file mode 100644 index 00000000..368c926b --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to delete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteBucket(request); + console.log(response); + } + + callDeleteBucket(); + // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_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/config_service_v2.delete_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js new file mode 100644 index 00000000..bf359314 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of an existing exclusion to delete: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteExclusion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteExclusion(request); + console.log(response); + } + + callDeleteExclusion(); + // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_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/config_service_v2.delete_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js new file mode 100644 index 00000000..6a714386 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js @@ -0,0 +1,66 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the link to delete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteLink() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await loggingClient.deleteLink(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteLink(); + // [END logging_v2_generated_ConfigServiceV2_DeleteLink_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/config_service_v2.delete_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js new file mode 100644 index 00000000..0d90840d --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js @@ -0,0 +1,68 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName) { + // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the sink to delete, including the + * parent resource and the sink identifier: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteSink() { + // Construct request + const request = { + sinkName, + }; + + // Run request + const response = await loggingClient.deleteSink(request); + console.log(response); + } + + callDeleteSink(); + // [END logging_v2_generated_ConfigServiceV2_DeleteSink_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/config_service_v2.delete_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js new file mode 100644 index 00000000..92ef8caf --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js @@ -0,0 +1,64 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the view to delete: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteView() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteView(request); + console.log(response); + } + + callDeleteView(); + // [END logging_v2_generated_ConfigServiceV2_DeleteView_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/config_service_v2.get_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js new file mode 100644 index 00000000..0f9a7811 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getBucket(request); + console.log(response); + } + + callGetBucket(); + // [END logging_v2_generated_ConfigServiceV2_GetBucket_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/config_service_v2.get_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js new file mode 100644 index 00000000..1256b615 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource for which to retrieve CMEK settings. + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * For example: + * `"organizations/12345/cmekSettings"` + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetCmekSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getCmekSettings(request); + console.log(response); + } + + callGetCmekSettings(); + // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_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/config_service_v2.get_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js new file mode 100644 index 00000000..a9459c99 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of an existing exclusion: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetExclusion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getExclusion(request); + console.log(response); + } + + callGetExclusion(); + // [END logging_v2_generated_ConfigServiceV2_GetExclusion_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/config_service_v2.get_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js new file mode 100644 index 00000000..d95999ae --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js @@ -0,0 +1,65 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the link: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetLink() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getLink(request); + console.log(response); + } + + callGetLink(); + // [END logging_v2_generated_ConfigServiceV2_GetLink_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/config_service_v2.get_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js new file mode 100644 index 00000000..99df9924 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource for which to retrieve settings. + * "projects/[PROJECT_ID]/settings" + * "organizations/[ORGANIZATION_ID]/settings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" + * "folders/[FOLDER_ID]/settings" + * For example: + * `"organizations/12345/settings"` + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getSettings(request); + console.log(response); + } + + callGetSettings(); + // [END logging_v2_generated_ConfigServiceV2_GetSettings_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/config_service_v2.get_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js new file mode 100644 index 00000000..21e331ee --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName) { + // [START logging_v2_generated_ConfigServiceV2_GetSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the sink: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetSink() { + // Construct request + const request = { + sinkName, + }; + + // Run request + const response = await loggingClient.getSink(request); + console.log(response); + } + + callGetSink(); + // [END logging_v2_generated_ConfigServiceV2_GetSink_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/config_service_v2.get_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js new file mode 100644 index 00000000..d487ce10 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js @@ -0,0 +1,64 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the policy: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetView() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getView(request); + console.log(response); + } + + callGetView(); + // [END logging_v2_generated_ConfigServiceV2_GetView_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/config_service_v2.list_buckets.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js new file mode 100644 index 00000000..48c9e415 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose buckets are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of LOCATION_ID will return all + * buckets. + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListBuckets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listBucketsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuckets(); + // [END logging_v2_generated_ConfigServiceV2_ListBuckets_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/config_service_v2.list_exclusions.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js new file mode 100644 index 00000000..888d53fd --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose exclusions are to be listed. + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListExclusions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listExclusionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExclusions(); + // [END logging_v2_generated_ConfigServiceV2_ListExclusions_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/config_service_v2.list_links.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js new file mode 100644 index 00000000..fa5ac843 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListLinks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose links are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListLinks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLinksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLinks(); + // [END logging_v2_generated_ConfigServiceV2_ListLinks_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/config_service_v2.list_sinks.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js new file mode 100644 index 00000000..85486c8c --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose sinks are to be listed: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListSinks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listSinksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSinks(); + // [END logging_v2_generated_ConfigServiceV2_ListSinks_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/config_service_v2.list_views.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js new file mode 100644 index 00000000..815ee322 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListViews_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The bucket whose views are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListViews() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listViewsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListViews(); + // [END logging_v2_generated_ConfigServiceV2_ListViews_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/config_service_v2.undelete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js new file mode 100644 index 00000000..da866082 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to undelete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUndeleteBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.undeleteBucket(request); + console.log(response); + } + + callUndeleteBucket(); + // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_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/config_service_v2.update_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js new file mode 100644 index 00000000..9c98e2d3 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js @@ -0,0 +1,82 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, bucket, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to update. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + /** + * Required. The updated bucket. + */ + // const bucket = {} + /** + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=retention_days` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateBucket() { + // Construct request + const request = { + name, + bucket, + updateMask, + }; + + // Run request + const response = await loggingClient.updateBucket(request); + console.log(response); + } + + callUpdateBucket(); + // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_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/config_service_v2.update_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js new file mode 100644 index 00000000..a06c31cc --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, bucket, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to update. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + /** + * Required. The updated bucket. + */ + // const bucket = {} + /** + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=retention_days` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateBucketAsync() { + // Construct request + const request = { + name, + bucket, + updateMask, + }; + + // Run request + const [operation] = await loggingClient.updateBucketAsync(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBucketAsync(); + // [END logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_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/config_service_v2.update_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js new file mode 100644 index 00000000..09012657 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, cmekSettings) { + // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the CMEK settings to update. + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * For example: + * `"organizations/12345/cmekSettings"` + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + */ + // const name = 'abc123' + /** + * Required. The CMEK settings to update. + * See Enabling CMEK for Log + * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + */ + // const cmekSettings = {} + /** + * Optional. Field mask identifying which fields from `cmek_settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * See FieldMask google.protobuf.FieldMask for more information. + * For example: `"updateMask=kmsKeyName"` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateCmekSettings() { + // Construct request + const request = { + name, + cmekSettings, + }; + + // Run request + const response = await loggingClient.updateCmekSettings(request); + console.log(response); + } + + callUpdateCmekSettings(); + // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_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/config_service_v2.update_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js new file mode 100644 index 00000000..11cc66d5 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, exclusion, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the exclusion to update: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + /** + * Required. New values for the existing exclusion. Only the fields specified + * in `update_mask` are relevant. + */ + // const exclusion = {} + /** + * Required. A non-empty list of fields to change in the existing exclusion. + * New values for the fields are taken from the corresponding fields in the + * LogExclusion google.logging.v2.LogExclusion included in this request. + * Fields not mentioned in `update_mask` are not changed and are ignored in + * the request. + * For example, to change the filter and description of an exclusion, + * specify an `update_mask` of `"filter,description"`. + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateExclusion() { + // Construct request + const request = { + name, + exclusion, + updateMask, + }; + + // Run request + const response = await loggingClient.updateExclusion(request); + console.log(response); + } + + callUpdateExclusion(); + // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_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/config_service_v2.update_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js new file mode 100644 index 00000000..35ebd66f --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, settings) { + // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the settings to update. + * "organizations/[ORGANIZATION_ID]/settings" + * For example: + * `"organizations/12345/settings"` + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + */ + // const name = 'abc123' + /** + * Required. The settings to update. + * See Enabling CMEK for Log + * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + */ + // const settings = {} + /** + * Optional. Field mask identifying which fields from `settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * See FieldMask google.protobuf.FieldMask for more information. + * For example: `"updateMask=kmsKeyName"` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateSettings() { + // Construct request + const request = { + name, + settings, + }; + + // Run request + const response = await loggingClient.updateSettings(request); + console.log(response); + } + + callUpdateSettings(); + // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_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/config_service_v2.update_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js new file mode 100644 index 00000000..7fd08496 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js @@ -0,0 +1,101 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName, sink) { + // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the sink to update, including the + * parent resource and the sink identifier: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + /** + * Required. The updated sink, whose name is the same identifier that appears + * as part of `sink_name`. + */ + // const sink = {} + /** + * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink + * for a description of this field. When updating a sink, the effect of this + * field on the value of `writer_identity` in the updated sink depends on both + * the old and new values of this field: + * + If the old and new values of this field are both false or both true, + * then there is no change to the sink's `writer_identity`. + * + If the old value is false and the new value is true, then + * `writer_identity` is changed to a unique service account. + * + It is an error if the old value is true and the new value is + * set to false or defaulted to false. + */ + // const uniqueWriterIdentity = true + /** + * Optional. Field mask that specifies the fields in `sink` that need + * an update. A sink field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * An empty `updateMask` is temporarily treated as using the following mask + * for backwards compatibility purposes: + * `destination,filter,includeChildren` + * At some point in the future, behavior will be removed and specifying an + * empty `updateMask` will be an error. + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=filter` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateSink() { + // Construct request + const request = { + sinkName, + sink, + }; + + // Run request + const response = await loggingClient.updateSink(request); + console.log(response); + } + + callUpdateSink(); + // [END logging_v2_generated_ConfigServiceV2_UpdateSink_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/config_service_v2.update_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js new file mode 100644 index 00000000..acc6bfb9 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, view) { + // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the view to update + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + /** + * Required. The updated view. + */ + // const view = {} + /** + * Optional. Field mask that specifies the fields in `view` that need + * an update. A field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=filter` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateView() { + // Construct request + const request = { + name, + view, + }; + + // Run request + const response = await loggingClient.updateView(request); + console.log(response); + } + + callUpdateView(); + // [END logging_v2_generated_ConfigServiceV2_UpdateView_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/logging_service_v2.delete_log.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js new file mode 100644 index 00000000..c8b817e7 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js @@ -0,0 +1,70 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(logName) { + // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the log to delete: + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * `[LOG_ID]` must be URL-encoded. For example, + * `"projects/my-project-id/logs/syslog"`, + * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + * For more information about log names, see + * LogEntry google.logging.v2.LogEntry. + */ + // const logName = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callDeleteLog() { + // Construct request + const request = { + logName, + }; + + // Run request + const response = await loggingClient.deleteLog(request); + console.log(response); + } + + callDeleteLog(); + // [END logging_v2_generated_LoggingServiceV2_DeleteLog_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/logging_service_v2.list_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js new file mode 100644 index 00000000..355fcc84 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js @@ -0,0 +1,106 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resourceNames) { + // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * May alternatively be one or more views: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + */ + // const resourceNames = ['abc','def'] + /** + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + */ + // const filter = 'abc123' + /** + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + */ + // const orderBy = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListLogEntries() { + // Construct request + const request = { + resourceNames, + }; + + // Run request + const iterable = await loggingClient.listLogEntriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_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/logging_service_v2.list_logs.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js new file mode 100644 index 00000000..1e8c7caa --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js @@ -0,0 +1,94 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name to list logs for: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + */ + // const parent = 'abc123' + /** + * Optional. List of resource names to list logs for: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * To support legacy queries, it could also be: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * The resource name in the `parent` field is added to this list. + */ + // const resourceNames = ['abc','def'] + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListLogs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLogsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogs(); + // [END logging_v2_generated_LoggingServiceV2_ListLogs_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/logging_service_v2.list_monitored_resource_descriptors.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js new file mode 100644 index 00000000..4552dacd --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListMonitoredResourceDescriptors() { + // Construct request + const request = { + }; + + // Run request + const iterable = await loggingClient.listMonitoredResourceDescriptorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMonitoredResourceDescriptors(); + // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_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/logging_service_v2.tail_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js new file mode 100644 index 00000000..a0d3eeb7 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js @@ -0,0 +1,89 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resourceNames) { + // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of a parent resource from which to retrieve log entries: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * May alternatively be one or more views: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + */ + // const resourceNames = ['abc','def'] + /** + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + */ + // const filter = 'abc123' + /** + * Optional. The amount of time to buffer log entries at the server before + * being returned to prevent out of order results due to late arriving log + * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 + * milliseconds. + */ + // const bufferWindow = {} + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callTailLogEntries() { + // Construct request + const request = { + resourceNames, + }; + + // Run request + const stream = await loggingClient.tailLogEntries(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callTailLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_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/logging_service_v2.write_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js new file mode 100644 index 00000000..888245ae --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js @@ -0,0 +1,129 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(entries) { + // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. A default log resource name that is assigned to all log entries + * in `entries` that do not specify a value for `log_name`: + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * `[LOG_ID]` must be URL-encoded. For example: + * "projects/my-project-id/logs/syslog" + * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + * The permission `logging.logEntries.create` is needed on each project, + * organization, billing account, or folder that is receiving new log + * entries, whether the resource is specified in `logName` or in an + * individual log entry. + */ + // const logName = 'abc123' + /** + * Optional. A default monitored resource object that is assigned to all log + * entries in `entries` that do not specify a value for `resource`. Example: + * { "type": "gce_instance", + * "labels": { + * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + * See LogEntry google.logging.v2.LogEntry. + */ + // const resource = {} + /** + * Optional. Default labels that are added to the `labels` field of all log + * entries in `entries`. If a log entry already has a label with the same key + * as a label in this parameter, then the log entry's label is not changed. + * See LogEntry google.logging.v2.LogEntry. + */ + // const labels = [1,2,3,4] + /** + * Required. The log entries to send to Logging. The order of log + * entries in this list does not matter. Values supplied in this method's + * `log_name`, `resource`, and `labels` fields are copied into those log + * entries in this list that do not include values for their corresponding + * fields. For more information, see the + * LogEntry google.logging.v2.LogEntry type. + * If the `timestamp` or `insert_id` fields are missing in log entries, then + * this method supplies the current time or a unique identifier, respectively. + * The supplied values are chosen so that, among the log entries that did not + * supply their own values, the entries earlier in the list will sort before + * the entries later in the list. See the `entries.list` method. + * Log entries with timestamps that are more than the + * logs retention period (https://cloud.google.com/logging/quotas) in + * the past or more than 24 hours in the future will not be available when + * calling `entries.list`. However, those log entries can still be exported + * with + * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + * To improve throughput and to avoid exceeding the + * quota limit (https://cloud.google.com/logging/quotas) for calls to + * `entries.write`, you should try to include several log entries in this + * list, rather than calling this method for each individual log entry. + */ + // const entries = [1,2,3,4] + /** + * Optional. Whether a batch's valid entries should be written even if some + * other entry failed due to a permanent error such as INVALID_ARGUMENT or + * PERMISSION_DENIED. If any entry failed, then the response status is the + * response status of one of the failed entries. The response will include + * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + * the entries' zero-based index in the `entries`. Failed requests for which + * no entries are written will not include per-entry errors. + */ + // const partialSuccess = true + /** + * Optional. If true, the request should expect normal response, but the + * entries won't be persisted nor exported. Useful for checking whether the + * logging API endpoints are working properly before sending valuable data. + */ + // const dryRun = true + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callWriteLogEntries() { + // Construct request + const request = { + entries, + }; + + // Run request + const response = await loggingClient.writeLogEntries(request); + console.log(response); + } + + callWriteLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_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/metrics_service_v2.create_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js new file mode 100644 index 00000000..b48ae935 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js @@ -0,0 +1,69 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, metric) { + // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project in which to create the metric: + * "projects/[PROJECT_ID]" + * The new metric must be provided in the request. + */ + // const parent = 'abc123' + /** + * Required. The new logs-based metric, which must not have an identifier that + * already exists. + */ + // const metric = {} + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callCreateLogMetric() { + // Construct request + const request = { + parent, + metric, + }; + + // Run request + const response = await loggingClient.createLogMetric(request); + console.log(response); + } + + callCreateLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_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/metrics_service_v2.delete_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js new file mode 100644 index 00000000..661e224f --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName) { + // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the metric to delete: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + */ + // const metricName = 'abc123' + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callDeleteLogMetric() { + // Construct request + const request = { + metricName, + }; + + // Run request + const response = await loggingClient.deleteLogMetric(request); + console.log(response); + } + + callDeleteLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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/metrics_service_v2.get_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js new file mode 100644 index 00000000..c8d8b6a0 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName) { + // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the desired metric: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + */ + // const metricName = 'abc123' + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callGetLogMetric() { + // Construct request + const request = { + metricName, + }; + + // Run request + const response = await loggingClient.getLogMetric(request); + console.log(response); + } + + callGetLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_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/metrics_service_v2.list_log_metrics.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js new file mode 100644 index 00000000..558322ef --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project containing the metrics: + * "projects/[PROJECT_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callListLogMetrics() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLogMetricsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogMetrics(); + // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_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/metrics_service_v2.update_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js new file mode 100644 index 00000000..942d8246 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js @@ -0,0 +1,70 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName, metric) { + // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the metric to update: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * The updated metric must be provided in the request and it's + * `name` field must be the same as `[METRIC_ID]` If the metric + * does not exist in `[PROJECT_ID]`, then a new metric is created. + */ + // const metricName = 'abc123' + /** + * Required. The updated metric. + */ + // const metric = {} + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callUpdateLogMetric() { + // Construct request + const request = { + metricName, + metric, + }; + + // Run request + const response = await loggingClient.updateLogMetric(request); + console.log(response); + } + + callUpdateLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_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.logging.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json new file mode 100644 index 00000000..c6798780 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json @@ -0,0 +1,1963 @@ +{ + "clientLibrary": { + "name": "nodejs-logging", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.logging.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", + "title": "logging listBuckets Sample", + "origin": "API_DEFINITION", + "description": " Lists log buckets.", + "canonical": true, + "file": "config_service_v2.list_buckets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuckets", + "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListBucketsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListBuckets", + "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", + "title": "logging getBucket Sample", + "origin": "API_DEFINITION", + "description": " Gets a log bucket.", + "canonical": true, + "file": "config_service_v2.get_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBucket", + "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetBucket", + "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async", + "title": "logging createBucketAsync Sample", + "origin": "API_DEFINITION", + "description": " Creates a log bucket asynchronously that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.create_bucket_async.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "bucket_id", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async", + "title": "logging updateBucketAsync Sample", + "origin": "API_DEFINITION", + "description": " Updates a log bucket asynchronously. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.update_bucket_async.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", + "title": "logging createBucket Sample", + "origin": "API_DEFINITION", + "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.create_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "bucket_id", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", + "title": "logging updateBucket Sample", + "origin": "API_DEFINITION", + "description": " Updates a log bucket. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.update_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", + "title": "logging deleteBucket Sample", + "origin": "API_DEFINITION", + "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", + "canonical": true, + "file": "config_service_v2.delete_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", + "title": "logging undeleteBucket Sample", + "origin": "API_DEFINITION", + "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", + "canonical": true, + "file": "config_service_v2.undelete_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UndeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", + "title": "logging listViews Sample", + "origin": "API_DEFINITION", + "description": " Lists views on a log bucket.", + "canonical": true, + "file": "config_service_v2.list_views.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListViews", + "fullName": "google.logging.v2.ConfigServiceV2.ListViews", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListViewsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListViews", + "fullName": "google.logging.v2.ConfigServiceV2.ListViews", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", + "title": "logging getView Sample", + "origin": "API_DEFINITION", + "description": " Gets a view on a log bucket..", + "canonical": true, + "file": "config_service_v2.get_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetView", + "fullName": "google.logging.v2.ConfigServiceV2.GetView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetView", + "fullName": "google.logging.v2.ConfigServiceV2.GetView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", + "title": "logging createView Sample", + "origin": "API_DEFINITION", + "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", + "canonical": true, + "file": "config_service_v2.create_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateView", + "fullName": "google.logging.v2.ConfigServiceV2.CreateView", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "view_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.logging.v2.LogView" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateView", + "fullName": "google.logging.v2.ConfigServiceV2.CreateView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", + "title": "logging updateView Sample", + "origin": "API_DEFINITION", + "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", + "canonical": true, + "file": "config_service_v2.update_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateView", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.logging.v2.LogView" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateView", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", + "title": "logging deleteView Sample", + "origin": "API_DEFINITION", + "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", + "canonical": true, + "file": "config_service_v2.delete_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteView", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteView", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", + "title": "logging listSinks Sample", + "origin": "API_DEFINITION", + "description": " Lists sinks.", + "canonical": true, + "file": "config_service_v2.list_sinks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListSinksResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListSinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", + "title": "logging getSink Sample", + "origin": "API_DEFINITION", + "description": " Gets a sink.", + "canonical": true, + "file": "config_service_v2.get_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSink", + "fullName": "google.logging.v2.ConfigServiceV2.GetSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetSink", + "fullName": "google.logging.v2.ConfigServiceV2.GetSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", + "title": "logging createSink Sample", + "origin": "API_DEFINITION", + "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "canonical": true, + "file": "config_service_v2.create_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "sink", + "type": ".google.logging.v2.LogSink" + }, + { + "name": "unique_writer_identity", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateSink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", + "title": "logging updateSink Sample", + "origin": "API_DEFINITION", + "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", + "canonical": true, + "file": "config_service_v2.update_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSink", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + }, + { + "name": "sink", + "type": ".google.logging.v2.LogSink" + }, + { + "name": "unique_writer_identity", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateSink", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", + "title": "logging deleteSink Sample", + "origin": "API_DEFINITION", + "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", + "canonical": true, + "file": "config_service_v2.delete_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteSink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateLink_async", + "title": "logging createLink Sample", + "origin": "API_DEFINITION", + "description": " Asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.", + "canonical": true, + "file": "config_service_v2.create_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateLink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "link", + "type": ".google.logging.v2.Link" + }, + { + "name": "link_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateLink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteLink_async", + "title": "logging deleteLink Sample", + "origin": "API_DEFINITION", + "description": " Deletes a link. This will also delete the corresponding BigQuery linked dataset.", + "canonical": true, + "file": "config_service_v2.delete_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteLink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListLinks_async", + "title": "logging listLinks Sample", + "origin": "API_DEFINITION", + "description": " Lists links.", + "canonical": true, + "file": "config_service_v2.list_links.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListLinksResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListLinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetLink_async", + "title": "logging getLink Sample", + "origin": "API_DEFINITION", + "description": " Gets a link.", + "canonical": true, + "file": "config_service_v2.get_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLink", + "fullName": "google.logging.v2.ConfigServiceV2.GetLink", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.Link", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetLink", + "fullName": "google.logging.v2.ConfigServiceV2.GetLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", + "title": "logging listExclusions Sample", + "origin": "API_DEFINITION", + "description": " Lists all the exclusions on the _Default sink in a parent resource.", + "canonical": true, + "file": "config_service_v2.list_exclusions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExclusions", + "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListExclusionsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListExclusions", + "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", + "title": "logging getExclusion Sample", + "origin": "API_DEFINITION", + "description": " Gets the description of an exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.get_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", + "title": "logging createExclusion Sample", + "origin": "API_DEFINITION", + "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", + "canonical": true, + "file": "config_service_v2.create_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "exclusion", + "type": ".google.logging.v2.LogExclusion" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", + "title": "logging updateExclusion Sample", + "origin": "API_DEFINITION", + "description": " Changes one or more properties of an existing exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.update_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "exclusion", + "type": ".google.logging.v2.LogExclusion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", + "title": "logging deleteExclusion Sample", + "origin": "API_DEFINITION", + "description": " Deletes an exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.delete_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", + "title": "logging getCmekSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.get_cmek_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.CmekSettings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", + "title": "logging updateCmekSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.update_cmek_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "cmek_settings", + "type": ".google.logging.v2.CmekSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.CmekSettings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", + "title": "logging getSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.get_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.Settings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", + "title": "logging updateSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.update_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "settings", + "type": ".google.logging.v2.Settings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.Settings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", + "title": "logging copyLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", + "canonical": true, + "file": "config_service_v2.copy_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CopyLogEntries", + "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "destination", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CopyLogEntries", + "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", + "title": "logging deleteLog Sample", + "origin": "API_DEFINITION", + "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", + "canonical": true, + "file": "logging_service_v2.delete_log.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLog", + "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", + "async": true, + "parameters": [ + { + "name": "log_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "DeleteLog", + "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", + "title": "logging writeLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", + "canonical": true, + "file": "logging_service_v2.write_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 121, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", + "async": true, + "parameters": [ + { + "name": "log_name", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.api.MonitoredResource" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "entries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "partial_success", + "type": "TYPE_BOOL" + }, + { + "name": "dry_run", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.logging.v2.WriteLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "WriteLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", + "title": "logging listLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", + "canonical": true, + "file": "logging_service_v2.list_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 98, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", + "async": true, + "parameters": [ + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", + "title": "logging listMonitoredResourceDescriptors Sample", + "origin": "API_DEFINITION", + "description": " Lists the descriptors for monitored resource types used by Logging.", + "canonical": true, + "file": "logging_service_v2.list_monitored_resource_descriptors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMonitoredResourceDescriptors", + "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListMonitoredResourceDescriptors", + "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", + "title": "logging listLogs Sample", + "origin": "API_DEFINITION", + "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", + "canonical": true, + "file": "logging_service_v2.list_logs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogs", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListLogsResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListLogs", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", + "title": "logging tailLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", + "canonical": true, + "file": "logging_service_v2.tail_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TailLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", + "async": true, + "parameters": [ + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "buffer_window", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.logging.v2.TailLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "TailLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", + "title": "logging listLogMetrics Sample", + "origin": "API_DEFINITION", + "description": " Lists logs-based metrics.", + "canonical": true, + "file": "metrics_service_v2.list_log_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogMetrics", + "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListLogMetricsResponse", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "ListLogMetrics", + "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", + "title": "logging getLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Gets a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.get_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "GetLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", + "title": "logging createLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Creates a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.create_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metric", + "type": ".google.logging.v2.LogMetric" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "CreateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", + "title": "logging updateLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.update_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + }, + { + "name": "metric", + "type": ".google.logging.v2.LogMetric" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "UpdateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", + "title": "logging deleteLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Deletes a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.delete_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "DeleteLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 00000000..ca1a43eb --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,29 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const ConfigServiceV2Client = v2.ConfigServiceV2Client; +type ConfigServiceV2Client = v2.ConfigServiceV2Client; +const LoggingServiceV2Client = v2.LoggingServiceV2Client; +type LoggingServiceV2Client = v2.LoggingServiceV2Client; +const MetricsServiceV2Client = v2.MetricsServiceV2Client; +type MetricsServiceV2Client = v2.MetricsServiceV2Client; +export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; +export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts new file mode 100644 index 00000000..f749a38b --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts @@ -0,0 +1,5530 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/config_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './config_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for configuring sinks used to route log entries. + * @class + * @memberof v2 + */ +export class ConfigServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + configServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConfigServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConfigServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConfigServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBuckets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), + listViews: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), + listSinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), + listLinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'links'), + listExclusions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=*/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=folders/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel',body: '*',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=*/*/locations/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=organizations/*/locations/*/operations/*}',},{get: '/v2/{name=folders/*/locations/*/operations/*}',},{get: '/v2/{name=billingAccounts/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=*/*/locations/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=organizations/*/locations/*}/operations',},{get: '/v2/{name=folders/*/locations/*}/operations',},{get: '/v2/{name=billingAccounts/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createBucketAsyncResponse = protoFilesRoot.lookup( + '.google.logging.v2.LogBucket') as gax.protobuf.Type; + const createBucketAsyncMetadata = protoFilesRoot.lookup( + '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; + const updateBucketAsyncResponse = protoFilesRoot.lookup( + '.google.logging.v2.LogBucket') as gax.protobuf.Type; + const updateBucketAsyncMetadata = protoFilesRoot.lookup( + '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; + const createLinkResponse = protoFilesRoot.lookup( + '.google.logging.v2.Link') as gax.protobuf.Type; + const createLinkMetadata = protoFilesRoot.lookup( + '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; + const deleteLinkResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteLinkMetadata = protoFilesRoot.lookup( + '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; + const copyLogEntriesResponse = protoFilesRoot.lookup( + '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; + const copyLogEntriesMetadata = protoFilesRoot.lookup( + '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBucketAsync: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBucketAsyncResponse.decode.bind(createBucketAsyncResponse), + createBucketAsyncMetadata.decode.bind(createBucketAsyncMetadata)), + updateBucketAsync: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBucketAsyncResponse.decode.bind(updateBucketAsyncResponse), + updateBucketAsyncMetadata.decode.bind(updateBucketAsyncMetadata)), + createLink: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createLinkResponse.decode.bind(createLinkResponse), + createLinkMetadata.decode.bind(createLinkMetadata)), + deleteLink: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteLinkResponse.decode.bind(deleteLinkResponse), + deleteLinkMetadata.decode.bind(deleteLinkMetadata)), + copyLogEntries: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), + copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.configServiceV2Stub) { + return this.configServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.ConfigServiceV2. + this.configServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.ConfigServiceV2, + 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 configServiceV2StubMethods = + ['listBuckets', 'getBucket', 'createBucketAsync', 'updateBucketAsync', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'createLink', 'deleteLink', 'listLinks', 'getLink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; + for (const methodName of configServiceV2StubMethods) { + const callPromise = this.configServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.configServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read' + ]; + } + + 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 -- + // ------------------- +/** + * Gets a log bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async + */ + getBucket( + request?: protos.google.logging.v2.IGetBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined + ]>; + getBucket( + request: protos.google.logging.v2.IGetBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): void; + getBucket( + request: protos.google.logging.v2.IGetBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): void; + getBucket( + request?: protos.google.logging.v2.IGetBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBucket(request, options, callback); + } +/** + * Creates a log bucket that can be used to store log entries. After a bucket + * has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the log bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * + * For example: + * + * `"projects/my-project/locations/global"` + * @param {string} request.bucketId + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async + */ + createBucket( + request?: protos.google.logging.v2.ICreateBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined + ]>; + createBucket( + request: protos.google.logging.v2.ICreateBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): void; + createBucket( + request: protos.google.logging.v2.ICreateBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): void; + createBucket( + request?: protos.google.logging.v2.ICreateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBucket(request, options, callback); + } +/** + * Updates a log bucket. + * + * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + * `FAILED_PRECONDITION` will be returned. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to update. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The updated bucket. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=retention_days` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async + */ + updateBucket( + request?: protos.google.logging.v2.IUpdateBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined + ]>; + updateBucket( + request: protos.google.logging.v2.IUpdateBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): void; + updateBucket( + request: protos.google.logging.v2.IUpdateBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): void; + updateBucket( + request?: protos.google.logging.v2.IUpdateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBucket(request, options, callback); + } +/** + * Deletes a log bucket. + * + * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. + * After 7 days, the bucket will be purged and all log entries in the bucket + * will be permanently deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to delete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async + */ + deleteBucket( + request?: protos.google.logging.v2.IDeleteBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined + ]>; + deleteBucket( + request: protos.google.logging.v2.IDeleteBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + deleteBucket( + request: protos.google.logging.v2.IDeleteBucketRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + deleteBucket( + request?: protos.google.logging.v2.IDeleteBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBucket(request, options, callback); + } +/** + * Undeletes a log bucket. A bucket that has been deleted can be undeleted + * within the grace period of 7 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to undelete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async + */ + undeleteBucket( + request?: protos.google.logging.v2.IUndeleteBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined + ]>; + undeleteBucket( + request: protos.google.logging.v2.IUndeleteBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + undeleteBucket( + request: protos.google.logging.v2.IUndeleteBucketRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + undeleteBucket( + request?: protos.google.logging.v2.IUndeleteBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.undeleteBucket(request, options, callback); + } +/** + * Gets a view on a log bucket.. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the policy: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async + */ + getView( + request?: protos.google.logging.v2.IGetViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined + ]>; + getView( + request: protos.google.logging.v2.IGetViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): void; + getView( + request: protos.google.logging.v2.IGetViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): void; + getView( + request?: protos.google.logging.v2.IGetViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getView(request, options, callback); + } +/** + * Creates a view over log entries in a log bucket. A bucket may contain a + * maximum of 30 views. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket in which to create the view + * + * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {string} request.viewId + * Required. A client-assigned identifier such as `"my-view"`. Identifiers are + * limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogView} request.view + * Required. The new view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async + */ + createView( + request?: protos.google.logging.v2.ICreateViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined + ]>; + createView( + request: protos.google.logging.v2.ICreateViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): void; + createView( + request: protos.google.logging.v2.ICreateViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): void; + createView( + request?: protos.google.logging.v2.ICreateViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createView(request, options, callback); + } +/** + * Updates a view on a log bucket. This method replaces the following fields + * in the existing view with values from the new view: `filter`. + * If an `UNAVAILABLE` error is returned, this indicates that system is not in + * a state where it can update the view. If this occurs, please try again in a + * few minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the view to update + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {google.logging.v2.LogView} request.view + * Required. The updated view. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask that specifies the fields in `view` that need + * an update. A field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=filter` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async + */ + updateView( + request?: protos.google.logging.v2.IUpdateViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined + ]>; + updateView( + request: protos.google.logging.v2.IUpdateViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): void; + updateView( + request: protos.google.logging.v2.IUpdateViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): void; + updateView( + request?: protos.google.logging.v2.IUpdateViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateView(request, options, callback); + } +/** + * Deletes a view on a log bucket. + * If an `UNAVAILABLE` error is returned, this indicates that system is not in + * a state where it can delete the view. If this occurs, please try again in a + * few minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the view to delete: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async + */ + deleteView( + request?: protos.google.logging.v2.IDeleteViewRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined + ]>; + deleteView( + request: protos.google.logging.v2.IDeleteViewRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): void; + deleteView( + request: protos.google.logging.v2.IDeleteViewRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): void; + deleteView( + request?: protos.google.logging.v2.IDeleteViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteView(request, options, callback); + } +/** + * Gets a sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The resource name of the sink: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async + */ + getSink( + request?: protos.google.logging.v2.IGetSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined + ]>; + getSink( + request: protos.google.logging.v2.IGetSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): void; + getSink( + request: protos.google.logging.v2.IGetSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): void; + getSink( + request?: protos.google.logging.v2.IGetSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSink(request, options, callback); + } +/** + * Creates a sink that exports specified log entries to a destination. The + * export of newly-ingested log entries begins immediately, unless the sink's + * `writer_identity` is not permitted to write to the destination. A sink can + * export log entries only from the resource owning the sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the sink: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * + * For examples: + * + * `"projects/my-project"` + * `"organizations/123456789"` + * @param {google.logging.v2.LogSink} request.sink + * Required. The new sink, whose `name` parameter is a sink identifier that + * is not already in use. + * @param {boolean} [request.uniqueWriterIdentity] + * Optional. Determines the kind of IAM identity returned as `writer_identity` + * in the new sink. If this value is omitted or set to false, and if the + * sink's parent is a project, then the value returned as `writer_identity` is + * the same group or service account used by Cloud Logging before the addition + * of writer identities to this API. The sink's destination must be in the + * same project as the sink itself. + * + * If this field is set to true, or if the sink is owned by a non-project + * resource such as an organization, then the value of `writer_identity` will + * be a unique service account used only for exports from the new sink. For + * more information, see `writer_identity` in + * {@link protos.google.logging.v2.LogSink|LogSink}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async + */ + createSink( + request?: protos.google.logging.v2.ICreateSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined + ]>; + createSink( + request: protos.google.logging.v2.ICreateSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): void; + createSink( + request: protos.google.logging.v2.ICreateSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): void; + createSink( + request?: protos.google.logging.v2.ICreateSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSink(request, options, callback); + } +/** + * Updates a sink. This method replaces the following fields in the existing + * sink with values from the new sink: `destination`, and `filter`. + * + * The updated sink might also have a new `writer_identity`; see the + * `unique_writer_identity` field. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The full resource name of the sink to update, including the + * parent resource and the sink identifier: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {google.logging.v2.LogSink} request.sink + * Required. The updated sink, whose name is the same identifier that appears + * as part of `sink_name`. + * @param {boolean} [request.uniqueWriterIdentity] + * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} + * for a description of this field. When updating a sink, the effect of this + * field on the value of `writer_identity` in the updated sink depends on both + * the old and new values of this field: + * + * + If the old and new values of this field are both false or both true, + * then there is no change to the sink's `writer_identity`. + * + If the old value is false and the new value is true, then + * `writer_identity` is changed to a unique service account. + * + It is an error if the old value is true and the new value is + * set to false or defaulted to false. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask that specifies the fields in `sink` that need + * an update. A sink field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * + * An empty `updateMask` is temporarily treated as using the following mask + * for backwards compatibility purposes: + * + * `destination,filter,includeChildren` + * + * At some point in the future, behavior will be removed and specifying an + * empty `updateMask` will be an error. + * + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=filter` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async + */ + updateSink( + request?: protos.google.logging.v2.IUpdateSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined + ]>; + updateSink( + request: protos.google.logging.v2.IUpdateSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): void; + updateSink( + request: protos.google.logging.v2.IUpdateSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): void; + updateSink( + request?: protos.google.logging.v2.IUpdateSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSink(request, options, callback); + } +/** + * Deletes a sink. If the sink has a unique `writer_identity`, then that + * service account is also deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The full resource name of the sink to delete, including the + * parent resource and the sink identifier: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async + */ + deleteSink( + request?: protos.google.logging.v2.IDeleteSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined + ]>; + deleteSink( + request: protos.google.logging.v2.IDeleteSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): void; + deleteSink( + request: protos.google.logging.v2.IDeleteSinkRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): void; + deleteSink( + request?: protos.google.logging.v2.IDeleteSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSink(request, options, callback); + } +/** + * Gets a link. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the link: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Link|Link}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetLink_async + */ + getLink( + request?: protos.google.logging.v2.IGetLinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined + ]>; + getLink( + request: protos.google.logging.v2.IGetLinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): void; + getLink( + request: protos.google.logging.v2.IGetLinkRequest, + callback: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): void; + getLink( + request?: protos.google.logging.v2.IGetLinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLink(request, options, callback); + } +/** + * Gets the description of an exclusion in the _Default sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of an existing exclusion: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async + */ + getExclusion( + request?: protos.google.logging.v2.IGetExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined + ]>; + getExclusion( + request: protos.google.logging.v2.IGetExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): void; + getExclusion( + request: protos.google.logging.v2.IGetExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): void; + getExclusion( + request?: protos.google.logging.v2.IGetExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExclusion(request, options, callback); + } +/** + * Creates a new exclusion in the _Default sink in a specified parent + * resource. Only log entries belonging to that resource can be excluded. You + * can have up to 10 exclusions in a resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource in which to create the exclusion: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * + * For examples: + * + * `"projects/my-logging-project"` + * `"organizations/123456789"` + * @param {google.logging.v2.LogExclusion} request.exclusion + * Required. The new exclusion, whose `name` parameter is an exclusion name + * that is not already used in the parent resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async + */ + createExclusion( + request?: protos.google.logging.v2.ICreateExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined + ]>; + createExclusion( + request: protos.google.logging.v2.ICreateExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): void; + createExclusion( + request: protos.google.logging.v2.ICreateExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): void; + createExclusion( + request?: protos.google.logging.v2.ICreateExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExclusion(request, options, callback); + } +/** + * Changes one or more properties of an existing exclusion in the _Default + * sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the exclusion to update: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {google.logging.v2.LogExclusion} request.exclusion + * Required. New values for the existing exclusion. Only the fields specified + * in `update_mask` are relevant. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A non-empty list of fields to change in the existing exclusion. + * New values for the fields are taken from the corresponding fields in the + * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. + * Fields not mentioned in `update_mask` are not changed and are ignored in + * the request. + * + * For example, to change the filter and description of an exclusion, + * specify an `update_mask` of `"filter,description"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async + */ + updateExclusion( + request?: protos.google.logging.v2.IUpdateExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined + ]>; + updateExclusion( + request: protos.google.logging.v2.IUpdateExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): void; + updateExclusion( + request: protos.google.logging.v2.IUpdateExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): void; + updateExclusion( + request?: protos.google.logging.v2.IUpdateExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateExclusion(request, options, callback); + } +/** + * Deletes an exclusion in the _Default sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of an existing exclusion to delete: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async + */ + deleteExclusion( + request?: protos.google.logging.v2.IDeleteExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined + ]>; + deleteExclusion( + request: protos.google.logging.v2.IDeleteExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): void; + deleteExclusion( + request: protos.google.logging.v2.IDeleteExclusionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): void; + deleteExclusion( + request?: protos.google.logging.v2.IDeleteExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteExclusion(request, options, callback); + } +/** + * Gets the Logging CMEK settings for the given resource. + * + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource for which to retrieve CMEK settings. + * + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * + * For example: + * + * `"organizations/12345/cmekSettings"` + * + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async + */ + getCmekSettings( + request?: protos.google.logging.v2.IGetCmekSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined + ]>; + getCmekSettings( + request: protos.google.logging.v2.IGetCmekSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + getCmekSettings( + request: protos.google.logging.v2.IGetCmekSettingsRequest, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + getCmekSettings( + request?: protos.google.logging.v2.IGetCmekSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCmekSettings(request, options, callback); + } +/** + * Updates the Log Router CMEK settings for the given resource. + * + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * + * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} + * will fail if 1) `kms_key_name` is invalid, or 2) the associated service + * account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + * 3) access to the key is disabled. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the CMEK settings to update. + * + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * + * For example: + * + * `"organizations/12345/cmekSettings"` + * + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * @param {google.logging.v2.CmekSettings} request.cmekSettings + * Required. The CMEK settings to update. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask identifying which fields from `cmek_settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * + * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. + * + * For example: `"updateMask=kmsKeyName"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async + */ + updateCmekSettings( + request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined + ]>; + updateCmekSettings( + request: protos.google.logging.v2.IUpdateCmekSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateCmekSettings( + request: protos.google.logging.v2.IUpdateCmekSettingsRequest, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateCmekSettings( + request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCmekSettings(request, options, callback); + } +/** + * Gets the Log Router settings for the given resource. + * + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource for which to retrieve settings. + * + * "projects/[PROJECT_ID]/settings" + * "organizations/[ORGANIZATION_ID]/settings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" + * "folders/[FOLDER_ID]/settings" + * + * For example: + * + * `"organizations/12345/settings"` + * + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async + */ + getSettings( + request?: protos.google.logging.v2.IGetSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined + ]>; + getSettings( + request: protos.google.logging.v2.IGetSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request: protos.google.logging.v2.IGetSettingsRequest, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request?: protos.google.logging.v2.IGetSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSettings(request, options, callback); + } +/** + * Updates the Log Router settings for the given resource. + * + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * + * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} + * will fail if 1) `kms_key_name` is invalid, or 2) the associated service + * account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + * 3) access to the key is disabled. 4) `location_id` is not supported by + * Logging. 5) `location_id` violate OrgPolicy. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the settings to update. + * + * "organizations/[ORGANIZATION_ID]/settings" + * + * For example: + * + * `"organizations/12345/settings"` + * + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * @param {google.logging.v2.Settings} request.settings + * Required. The settings to update. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask identifying which fields from `settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * + * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. + * + * For example: `"updateMask=kmsKeyName"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async + */ + updateSettings( + request?: protos.google.logging.v2.IUpdateSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined + ]>; + updateSettings( + request: protos.google.logging.v2.IUpdateSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request: protos.google.logging.v2.IUpdateSettingsRequest, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request?: protos.google.logging.v2.IUpdateSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSettings(request, options, callback); + } + +/** + * Creates a log bucket asynchronously that can be used to store log entries. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the log bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * + * For example: + * + * `"projects/my-project/locations/global"` + * @param {string} request.bucketId + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async + */ + createBucketAsync( + request?: protos.google.logging.v2.ICreateBucketRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBucketAsync( + request: protos.google.logging.v2.ICreateBucketRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBucketAsync( + request: protos.google.logging.v2.ICreateBucketRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBucketAsync( + request?: protos.google.logging.v2.ICreateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBucketAsync(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async + */ + async checkCreateBucketAsyncProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a log bucket asynchronously. + * + * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + * `FAILED_PRECONDITION` will be returned. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to update. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The updated bucket. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=retention_days` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async + */ + updateBucketAsync( + request?: protos.google.logging.v2.IUpdateBucketRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBucketAsync( + request: protos.google.logging.v2.IUpdateBucketRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBucketAsync( + request: protos.google.logging.v2.IUpdateBucketRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBucketAsync( + request?: protos.google.logging.v2.IUpdateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBucketAsync(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async + */ + async checkUpdateBucketAsyncProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Asynchronously creates a linked dataset in BigQuery which makes it possible + * to use BigQuery to read the logs stored in the log bucket. A log bucket may + * currently only contain one link. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The full resource name of the bucket to create a link for. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {google.logging.v2.Link} request.link + * Required. The new link. + * @param {string} request.linkId + * Required. The ID to use for the link. The link_id can have up to 100 + * characters. A valid link_id must only have alphanumeric characters and + * underscores within it. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async + */ + createLink( + request?: protos.google.logging.v2.ICreateLinkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createLink( + request: protos.google.logging.v2.ICreateLinkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createLink( + request: protos.google.logging.v2.ICreateLinkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createLink( + request?: protos.google.logging.v2.ICreateLinkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createLink(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async + */ + async checkCreateLinkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a link. This will also delete the corresponding BigQuery linked + * dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the link to delete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async + */ + deleteLink( + request?: protos.google.logging.v2.IDeleteLinkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteLink( + request: protos.google.logging.v2.IDeleteLinkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteLink( + request: protos.google.logging.v2.IDeleteLinkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteLink( + request?: protos.google.logging.v2.IDeleteLinkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLink(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async + */ + async checkDeleteLinkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Copies a set of log entries from a log bucket to a Cloud Storage bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Log bucket from which to copy log entries. + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-source-bucket"` + * @param {string} [request.filter] + * Optional. A filter specifying which log entries to copy. The filter must be + * no more than 20k characters. An empty filter matches all log entries. + * @param {string} request.destination + * Required. Destination to which to copy log entries. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js + * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async + */ + copyLogEntries( + request?: protos.google.logging.v2.ICopyLogEntriesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + copyLogEntries( + request: protos.google.logging.v2.ICopyLogEntriesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyLogEntries( + request: protos.google.logging.v2.ICopyLogEntriesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyLogEntries( + request?: protos.google.logging.v2.ICopyLogEntriesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|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 || {}; + this.initialize(); + return this.innerApiCalls.copyLogEntries(request, options, callback); + } +/** + * Check the status of the long running operation returned by `copyLogEntries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js + * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async + */ + async checkCopyLogEntriesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists log buckets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBucketsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuckets( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket[], + protos.google.logging.v2.IListBucketsRequest|null, + protos.google.logging.v2.IListBucketsResponse + ]>; + listBuckets( + request: protos.google.logging.v2.IListBucketsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): void; + listBuckets( + request: protos.google.logging.v2.IListBucketsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): void; + listBuckets( + request?: protos.google.logging.v2.IListBucketsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>, + callback?: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): + Promise<[ + protos.google.logging.v2.ILogBucket[], + protos.google.logging.v2.IListBucketsRequest|null, + protos.google.logging.v2.IListBucketsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBuckets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogBucket|LogBucket} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBucketsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBucketsStream( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.createStream( + this.innerApiCalls.listBuckets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuckets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogBucket|LogBucket}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_buckets.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async + */ + listBucketsAsync( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.asyncIterate( + this.innerApiCalls['listBuckets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists views on a log bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogView|LogView}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listViewsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listViews( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView[], + protos.google.logging.v2.IListViewsRequest|null, + protos.google.logging.v2.IListViewsResponse + ]>; + listViews( + request: protos.google.logging.v2.IListViewsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): void; + listViews( + request: protos.google.logging.v2.IListViewsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): void; + listViews( + request?: protos.google.logging.v2.IListViewsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>, + callback?: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): + Promise<[ + protos.google.logging.v2.ILogView[], + protos.google.logging.v2.IListViewsRequest|null, + protos.google.logging.v2.IListViewsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listViews(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogView|LogView} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listViewsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listViewsStream( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.createStream( + this.innerApiCalls.listViews as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listViews`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogView|LogView}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_views.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async + */ + listViewsAsync( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.asyncIterate( + this.innerApiCalls['listViews'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists sinks. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogSink|LogSink}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSinks( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink[], + protos.google.logging.v2.IListSinksRequest|null, + protos.google.logging.v2.IListSinksResponse + ]>; + listSinks( + request: protos.google.logging.v2.IListSinksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): void; + listSinks( + request: protos.google.logging.v2.IListSinksRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): void; + listSinks( + request?: protos.google.logging.v2.IListSinksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>, + callback?: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): + Promise<[ + protos.google.logging.v2.ILogSink[], + protos.google.logging.v2.IListSinksRequest|null, + protos.google.logging.v2.IListSinksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSinks(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogSink|LogSink} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSinksStream( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.createStream( + this.innerApiCalls.listSinks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogSink|LogSink}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_sinks.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async + */ + listSinksAsync( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.asyncIterate( + this.innerApiCalls['listSinks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists links. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.Link|Link}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLinks( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILink[], + protos.google.logging.v2.IListLinksRequest|null, + protos.google.logging.v2.IListLinksResponse + ]>; + listLinks( + request: protos.google.logging.v2.IListLinksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): void; + listLinks( + request: protos.google.logging.v2.IListLinksRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): void; + listLinks( + request?: protos.google.logging.v2.IListLinksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): + Promise<[ + protos.google.logging.v2.ILink[], + protos.google.logging.v2.IListLinksRequest|null, + protos.google.logging.v2.IListLinksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLinks(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.Link|Link} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLinksStream( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.createStream( + this.innerApiCalls.listLinks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.Link|Link}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_links.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListLinks_async + */ + listLinksAsync( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.asyncIterate( + this.innerApiCalls['listLinks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all the exclusions on the _Default sink in a parent resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExclusionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExclusions( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion[], + protos.google.logging.v2.IListExclusionsRequest|null, + protos.google.logging.v2.IListExclusionsResponse + ]>; + listExclusions( + request: protos.google.logging.v2.IListExclusionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): void; + listExclusions( + request: protos.google.logging.v2.IListExclusionsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): void; + listExclusions( + request?: protos.google.logging.v2.IListExclusionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>, + callback?: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): + Promise<[ + protos.google.logging.v2.ILogExclusion[], + protos.google.logging.v2.IListExclusionsRequest|null, + protos.google.logging.v2.IListExclusionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExclusions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExclusionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExclusionsStream( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.createStream( + this.innerApiCalls.listExclusions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExclusions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogExclusion|LogExclusion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_exclusions.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async + */ + listExclusionsAsync( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.asyncIterate( + this.innerApiCalls['listExclusions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.configServiceV2Stub && !this._terminated) { + return this.configServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json new file mode 100644 index 00000000..0e890aa4 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json @@ -0,0 +1,169 @@ +{ + "interfaces": { + "google.logging.v2.ConfigServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "ListBuckets": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBucketAsync": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBucketAsync": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeleteBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListViews": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSinks": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateSink": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListLinks": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListExclusions": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateExclusion": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateExclusion": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetCmekSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCmekSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CopyLogEntries": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.proto" +] 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 00000000..047d5888 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,512 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.logging.v2", + "libraryPackage": "@google-cloud/logging", + "services": { + "ConfigServiceV2": { + "clients": { + "grpc": { + "libraryClient": "ConfigServiceV2Client", + "rpcs": { + "GetBucket": { + "methods": [ + "getBucket" + ] + }, + "CreateBucket": { + "methods": [ + "createBucket" + ] + }, + "UpdateBucket": { + "methods": [ + "updateBucket" + ] + }, + "DeleteBucket": { + "methods": [ + "deleteBucket" + ] + }, + "UndeleteBucket": { + "methods": [ + "undeleteBucket" + ] + }, + "GetView": { + "methods": [ + "getView" + ] + }, + "CreateView": { + "methods": [ + "createView" + ] + }, + "UpdateView": { + "methods": [ + "updateView" + ] + }, + "DeleteView": { + "methods": [ + "deleteView" + ] + }, + "GetSink": { + "methods": [ + "getSink" + ] + }, + "CreateSink": { + "methods": [ + "createSink" + ] + }, + "UpdateSink": { + "methods": [ + "updateSink" + ] + }, + "DeleteSink": { + "methods": [ + "deleteSink" + ] + }, + "GetLink": { + "methods": [ + "getLink" + ] + }, + "GetExclusion": { + "methods": [ + "getExclusion" + ] + }, + "CreateExclusion": { + "methods": [ + "createExclusion" + ] + }, + "UpdateExclusion": { + "methods": [ + "updateExclusion" + ] + }, + "DeleteExclusion": { + "methods": [ + "deleteExclusion" + ] + }, + "GetCmekSettings": { + "methods": [ + "getCmekSettings" + ] + }, + "UpdateCmekSettings": { + "methods": [ + "updateCmekSettings" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateBucketAsync": { + "methods": [ + "createBucketAsync" + ] + }, + "UpdateBucketAsync": { + "methods": [ + "updateBucketAsync" + ] + }, + "CreateLink": { + "methods": [ + "createLink" + ] + }, + "DeleteLink": { + "methods": [ + "deleteLink" + ] + }, + "CopyLogEntries": { + "methods": [ + "copyLogEntries" + ] + }, + "ListBuckets": { + "methods": [ + "listBuckets", + "listBucketsStream", + "listBucketsAsync" + ] + }, + "ListViews": { + "methods": [ + "listViews", + "listViewsStream", + "listViewsAsync" + ] + }, + "ListSinks": { + "methods": [ + "listSinks", + "listSinksStream", + "listSinksAsync" + ] + }, + "ListLinks": { + "methods": [ + "listLinks", + "listLinksStream", + "listLinksAsync" + ] + }, + "ListExclusions": { + "methods": [ + "listExclusions", + "listExclusionsStream", + "listExclusionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConfigServiceV2Client", + "rpcs": { + "GetBucket": { + "methods": [ + "getBucket" + ] + }, + "CreateBucket": { + "methods": [ + "createBucket" + ] + }, + "UpdateBucket": { + "methods": [ + "updateBucket" + ] + }, + "DeleteBucket": { + "methods": [ + "deleteBucket" + ] + }, + "UndeleteBucket": { + "methods": [ + "undeleteBucket" + ] + }, + "GetView": { + "methods": [ + "getView" + ] + }, + "CreateView": { + "methods": [ + "createView" + ] + }, + "UpdateView": { + "methods": [ + "updateView" + ] + }, + "DeleteView": { + "methods": [ + "deleteView" + ] + }, + "GetSink": { + "methods": [ + "getSink" + ] + }, + "CreateSink": { + "methods": [ + "createSink" + ] + }, + "UpdateSink": { + "methods": [ + "updateSink" + ] + }, + "DeleteSink": { + "methods": [ + "deleteSink" + ] + }, + "GetLink": { + "methods": [ + "getLink" + ] + }, + "GetExclusion": { + "methods": [ + "getExclusion" + ] + }, + "CreateExclusion": { + "methods": [ + "createExclusion" + ] + }, + "UpdateExclusion": { + "methods": [ + "updateExclusion" + ] + }, + "DeleteExclusion": { + "methods": [ + "deleteExclusion" + ] + }, + "GetCmekSettings": { + "methods": [ + "getCmekSettings" + ] + }, + "UpdateCmekSettings": { + "methods": [ + "updateCmekSettings" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateBucketAsync": { + "methods": [ + "createBucketAsync" + ] + }, + "UpdateBucketAsync": { + "methods": [ + "updateBucketAsync" + ] + }, + "CreateLink": { + "methods": [ + "createLink" + ] + }, + "DeleteLink": { + "methods": [ + "deleteLink" + ] + }, + "CopyLogEntries": { + "methods": [ + "copyLogEntries" + ] + }, + "ListBuckets": { + "methods": [ + "listBuckets", + "listBucketsStream", + "listBucketsAsync" + ] + }, + "ListViews": { + "methods": [ + "listViews", + "listViewsStream", + "listViewsAsync" + ] + }, + "ListSinks": { + "methods": [ + "listSinks", + "listSinksStream", + "listSinksAsync" + ] + }, + "ListLinks": { + "methods": [ + "listLinks", + "listLinksStream", + "listLinksAsync" + ] + }, + "ListExclusions": { + "methods": [ + "listExclusions", + "listExclusionsStream", + "listExclusionsAsync" + ] + } + } + } + } + }, + "LoggingServiceV2": { + "clients": { + "grpc": { + "libraryClient": "LoggingServiceV2Client", + "rpcs": { + "DeleteLog": { + "methods": [ + "deleteLog" + ] + }, + "WriteLogEntries": { + "methods": [ + "writeLogEntries" + ] + }, + "TailLogEntries": { + "methods": [ + "tailLogEntries" + ] + }, + "ListLogEntries": { + "methods": [ + "listLogEntries", + "listLogEntriesStream", + "listLogEntriesAsync" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListLogs": { + "methods": [ + "listLogs", + "listLogsStream", + "listLogsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "LoggingServiceV2Client", + "rpcs": { + "DeleteLog": { + "methods": [ + "deleteLog" + ] + }, + "WriteLogEntries": { + "methods": [ + "writeLogEntries" + ] + }, + "ListLogEntries": { + "methods": [ + "listLogEntries", + "listLogEntriesStream", + "listLogEntriesAsync" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListLogs": { + "methods": [ + "listLogs", + "listLogsStream", + "listLogsAsync" + ] + } + } + } + } + }, + "MetricsServiceV2": { + "clients": { + "grpc": { + "libraryClient": "MetricsServiceV2Client", + "rpcs": { + "GetLogMetric": { + "methods": [ + "getLogMetric" + ] + }, + "CreateLogMetric": { + "methods": [ + "createLogMetric" + ] + }, + "UpdateLogMetric": { + "methods": [ + "updateLogMetric" + ] + }, + "DeleteLogMetric": { + "methods": [ + "deleteLogMetric" + ] + }, + "ListLogMetrics": { + "methods": [ + "listLogMetrics", + "listLogMetricsStream", + "listLogMetricsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MetricsServiceV2Client", + "rpcs": { + "GetLogMetric": { + "methods": [ + "getLogMetric" + ] + }, + "CreateLogMetric": { + "methods": [ + "createLogMetric" + ] + }, + "UpdateLogMetric": { + "methods": [ + "updateLogMetric" + ] + }, + "DeleteLogMetric": { + "methods": [ + "deleteLogMetric" + ] + }, + "ListLogMetrics": { + "methods": [ + "listLogMetrics", + "listLogMetricsStream", + "listLogMetricsAsync" + ] + } + } + } + } + } + } +} 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 00000000..75a03763 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,21 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {ConfigServiceV2Client} from './config_service_v2_client'; +export {LoggingServiceV2Client} from './logging_service_v2_client'; +export {MetricsServiceV2Client} from './metrics_service_v2_client'; diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts new file mode 100644 index 00000000..cdf06265 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts @@ -0,0 +1,2754 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/logging_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './logging_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting and querying logs. + * @class + * @memberof v2 + */ +export class LoggingServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + loggingServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of LoggingServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new LoggingServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof LoggingServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogEntries: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), + listMonitoredResourceDescriptors: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), + listLogs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // Some methods on this API support automatically batching + // requests; denote this. + + this.descriptors.batching = { + writeLogEntries: new this._gaxModule.BundleDescriptor( + 'entries', + ['log_name','resource','labels'], + null, + this._gaxModule.GrpcClient.createByteLengthFunction( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.loggingServiceV2Stub) { + return this.loggingServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.LoggingServiceV2. + this.loggingServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.LoggingServiceV2, + 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 loggingServiceV2StubMethods = + ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; + for (const methodName of loggingServiceV2StubMethods) { + const callPromise = this.loggingServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.batching?.[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.loggingServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write' + ]; + } + + 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 -- + // ------------------- +/** + * Deletes all the log entries in a log for the _Default Log Bucket. The log + * reappears if it receives new entries. Log entries written shortly before + * the delete operation might not be deleted. Entries received after the + * delete operation with a timestamp before the operation will be deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.logName + * Required. The resource name of the log to delete: + * + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * + * `[LOG_ID]` must be URL-encoded. For example, + * `"projects/my-project-id/logs/syslog"`, + * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + * + * For more information about log names, see + * {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.delete_log.js + * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async + */ + deleteLog( + request?: protos.google.logging.v2.IDeleteLogRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined + ]>; + deleteLog( + request: protos.google.logging.v2.IDeleteLogRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): void; + deleteLog( + request: protos.google.logging.v2.IDeleteLogRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): void; + deleteLog( + request?: protos.google.logging.v2.IDeleteLogRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'log_name': request.logName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLog(request, options, callback); + } +/** + * Writes log entries to Logging. This API method is the + * only way to send log entries to Logging. This method + * is used, directly or indirectly, by the Logging agent + * (fluentd) and all logging libraries configured to use Logging. + * A single request may contain log entries for a maximum of 1000 + * different resources (projects, organizations, billing accounts or + * folders) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.logName] + * Optional. A default log resource name that is assigned to all log entries + * in `entries` that do not specify a value for `log_name`: + * + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * + * `[LOG_ID]` must be URL-encoded. For example: + * + * "projects/my-project-id/logs/syslog" + * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + * + * The permission `logging.logEntries.create` is needed on each project, + * organization, billing account, or folder that is receiving new log + * entries, whether the resource is specified in `logName` or in an + * individual log entry. + * @param {google.api.MonitoredResource} [request.resource] + * Optional. A default monitored resource object that is assigned to all log + * entries in `entries` that do not specify a value for `resource`. Example: + * + * { "type": "gce_instance", + * "labels": { + * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + * + * See {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {number[]} [request.labels] + * Optional. Default labels that are added to the `labels` field of all log + * entries in `entries`. If a log entry already has a label with the same key + * as a label in this parameter, then the log entry's label is not changed. + * See {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {number[]} request.entries + * Required. The log entries to send to Logging. The order of log + * entries in this list does not matter. Values supplied in this method's + * `log_name`, `resource`, and `labels` fields are copied into those log + * entries in this list that do not include values for their corresponding + * fields. For more information, see the + * {@link protos.google.logging.v2.LogEntry|LogEntry} type. + * + * If the `timestamp` or `insert_id` fields are missing in log entries, then + * this method supplies the current time or a unique identifier, respectively. + * The supplied values are chosen so that, among the log entries that did not + * supply their own values, the entries earlier in the list will sort before + * the entries later in the list. See the `entries.list` method. + * + * Log entries with timestamps that are more than the + * [logs retention period](https://cloud.google.com/logging/quotas) in + * the past or more than 24 hours in the future will not be available when + * calling `entries.list`. However, those log entries can still be [exported + * with + * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + * + * To improve throughput and to avoid exceeding the + * [quota limit](https://cloud.google.com/logging/quotas) for calls to + * `entries.write`, you should try to include several log entries in this + * list, rather than calling this method for each individual log entry. + * @param {boolean} [request.partialSuccess] + * Optional. Whether a batch's valid entries should be written even if some + * other entry failed due to a permanent error such as INVALID_ARGUMENT or + * PERMISSION_DENIED. If any entry failed, then the response status is the + * response status of one of the failed entries. The response will include + * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + * the entries' zero-based index in the `entries`. Failed requests for which + * no entries are written will not include per-entry errors. + * @param {boolean} [request.dryRun] + * Optional. If true, the request should expect normal response, but the + * entries won't be persisted nor exported. Useful for checking whether the + * logging API endpoints are working properly before sending valuable data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async + */ + writeLogEntries( + request?: protos.google.logging.v2.IWriteLogEntriesRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined + ]>; + writeLogEntries( + request: protos.google.logging.v2.IWriteLogEntriesRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): void; + writeLogEntries( + request: protos.google.logging.v2.IWriteLogEntriesRequest, + callback: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): void; + writeLogEntries( + request?: protos.google.logging.v2.IWriteLogEntriesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.writeLogEntries(request, options, callback); + } + +/** + * Streaming read of log entries as they are ingested. Until the stream is + * terminated, it will continue reading logs. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and + * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async + */ + tailLogEntries( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.tailLogEntries(null, options); + } + + /** + * Lists log entries. Use this method to retrieve log entries that originated + * from a project/folder/organization/billing account. For ways to export log + * entries, see [Exporting + * Logs](https://cloud.google.com/logging/docs/export). + * + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogEntriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogEntries( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogEntry[], + protos.google.logging.v2.IListLogEntriesRequest|null, + protos.google.logging.v2.IListLogEntriesResponse + ]>; + listLogEntries( + request: protos.google.logging.v2.IListLogEntriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): void; + listLogEntries( + request: protos.google.logging.v2.IListLogEntriesRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): void; + listLogEntries( + request?: protos.google.logging.v2.IListLogEntriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): + Promise<[ + protos.google.logging.v2.ILogEntry[], + protos.google.logging.v2.IListLogEntriesRequest|null, + protos.google.logging.v2.IListLogEntriesResponse + ]>|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 || {}; + this.initialize(); + return this.innerApiCalls.listLogEntries(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogEntry|LogEntry} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogEntriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogEntriesStream( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.createStream( + this.innerApiCalls.listLogEntries as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogEntries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogEntry|LogEntry}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async + */ + listLogEntriesAsync( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.asyncIterate( + this.innerApiCalls['listLogEntries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the descriptors for monitored resource types used by Logging. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMonitoredResourceDescriptors( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse + ]>; + listMonitoredResourceDescriptors( + request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): void; + listMonitoredResourceDescriptors( + request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): void; + listMonitoredResourceDescriptors( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>, + callback?: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): + Promise<[ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse + ]>|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 || {}; + this.initialize(); + return this.innerApiCalls.listMonitoredResourceDescriptors(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMonitoredResourceDescriptorsStream( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.createStream( + this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async + */ + listMonitoredResourceDescriptorsAsync( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( + this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the logs in projects, organizations, folders, or billing accounts. + * Only logs that have entries are listed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of string. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogs( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + Promise<[ + string[], + protos.google.logging.v2.IListLogsRequest|null, + protos.google.logging.v2.IListLogsResponse + ]>; + listLogs( + request: protos.google.logging.v2.IListLogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): void; + listLogs( + request: protos.google.logging.v2.IListLogsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): void; + listLogs( + request?: protos.google.logging.v2.IListLogsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): + Promise<[ + string[], + protos.google.logging.v2.IListLogsRequest|null, + protos.google.logging.v2.IListLogsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLogs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing string on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogsStream( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.createStream( + this.innerApiCalls.listLogs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_logs.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async + */ + listLogsAsync( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.asyncIterate( + this.innerApiCalls['listLogs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.loggingServiceV2Stub && !this._terminated) { + return this.loggingServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json new file mode 100644 index 00000000..342e96e9 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json @@ -0,0 +1,67 @@ +{ + "interfaces": { + "google.logging.v2.LoggingServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "DeleteLog": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "WriteLogEntries": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default", + "bundling": { + "element_count_threshold": 1000, + "request_byte_threshold": 1048576, + "delay_threshold_millis": 50, + "element_count_limit": 1000000 + } + }, + "ListLogEntries": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListMonitoredResourceDescriptors": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListLogs": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "TailLogEntries": { + "timeout_millis": 3600000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.proto" +] diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts new file mode 100644 index 00000000..39c5205d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts @@ -0,0 +1,2288 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/metrics_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './metrics_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for configuring logs-based metrics. + * @class + * @memberof v2 + */ +export class MetricsServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + metricsServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MetricsServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new MetricsServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof MetricsServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogMetrics: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.metricsServiceV2Stub) { + return this.metricsServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.MetricsServiceV2. + this.metricsServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.MetricsServiceV2, + 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 metricsServiceV2StubMethods = + ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; + for (const methodName of metricsServiceV2StubMethods) { + const callPromise = this.metricsServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.metricsServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write' + ]; + } + + 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 -- + // ------------------- +/** + * Gets a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the desired metric: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async + */ + getLogMetric( + request?: protos.google.logging.v2.IGetLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined + ]>; + getLogMetric( + request: protos.google.logging.v2.IGetLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): void; + getLogMetric( + request: protos.google.logging.v2.IGetLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): void; + getLogMetric( + request?: protos.google.logging.v2.IGetLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLogMetric(request, options, callback); + } +/** + * Creates a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project in which to create the metric: + * + * "projects/[PROJECT_ID]" + * + * The new metric must be provided in the request. + * @param {google.logging.v2.LogMetric} request.metric + * Required. The new logs-based metric, which must not have an identifier that + * already exists. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async + */ + createLogMetric( + request?: protos.google.logging.v2.ICreateLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined + ]>; + createLogMetric( + request: protos.google.logging.v2.ICreateLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + createLogMetric( + request: protos.google.logging.v2.ICreateLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + createLogMetric( + request?: protos.google.logging.v2.ICreateLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createLogMetric(request, options, callback); + } +/** + * Creates or updates a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the metric to update: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * + * The updated metric must be provided in the request and it's + * `name` field must be the same as `[METRIC_ID]` If the metric + * does not exist in `[PROJECT_ID]`, then a new metric is created. + * @param {google.logging.v2.LogMetric} request.metric + * Required. The updated metric. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async + */ + updateLogMetric( + request?: protos.google.logging.v2.IUpdateLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined + ]>; + updateLogMetric( + request: protos.google.logging.v2.IUpdateLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + updateLogMetric( + request: protos.google.logging.v2.IUpdateLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + updateLogMetric( + request?: protos.google.logging.v2.IUpdateLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateLogMetric(request, options, callback); + } +/** + * Deletes a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the metric to delete: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async + */ + deleteLogMetric( + request?: protos.google.logging.v2.IDeleteLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined + ]>; + deleteLogMetric( + request: protos.google.logging.v2.IDeleteLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): void; + deleteLogMetric( + request: protos.google.logging.v2.IDeleteLogMetricRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): void; + deleteLogMetric( + request?: protos.google.logging.v2.IDeleteLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLogMetric(request, options, callback); + } + + /** + * Lists logs-based metrics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogMetricsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogMetrics( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric[], + protos.google.logging.v2.IListLogMetricsRequest|null, + protos.google.logging.v2.IListLogMetricsResponse + ]>; + listLogMetrics( + request: protos.google.logging.v2.IListLogMetricsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): void; + listLogMetrics( + request: protos.google.logging.v2.IListLogMetricsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): void; + listLogMetrics( + request?: protos.google.logging.v2.IListLogMetricsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): + Promise<[ + protos.google.logging.v2.ILogMetric[], + protos.google.logging.v2.IListLogMetricsRequest|null, + protos.google.logging.v2.IListLogMetricsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLogMetrics(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogMetric|LogMetric} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogMetricsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogMetricsStream( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.createStream( + this.innerApiCalls.listLogMetrics as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogMetrics`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogMetric|LogMetric}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.list_log_metrics.js + * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async + */ + listLogMetricsAsync( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.asyncIterate( + this.innerApiCalls['listLogMetrics'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.metricsServiceV2Stub && !this._terminated) { + return this.metricsServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json new file mode 100644 index 00000000..014688ab --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.logging.v2.MetricsServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "ListLogMetrics": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.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 00000000..e3fe4bd9 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,29 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const logging = require('@google-cloud/logging'); + +function main() { + const configServiceV2Client = new logging.ConfigServiceV2Client(); + const loggingServiceV2Client = new logging.LoggingServiceV2Client(); + const metricsServiceV2Client = new logging.MetricsServiceV2Client(); +} + +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 00000000..a8f19533 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,44 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from '@google-cloud/logging'; + +// check that the client class type name can be used +function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { + client.close(); +} +function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { + client.close(); +} +function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const configServiceV2Client = new ConfigServiceV2Client(); + doStuffWithConfigServiceV2Client(configServiceV2Client); + // check that the client instance can be created + const loggingServiceV2Client = new LoggingServiceV2Client(); + doStuffWithLoggingServiceV2Client(loggingServiceV2Client); + // check that the client instance can be created + const metricsServiceV2Client = new MetricsServiceV2Client(); + doStuffWithMetricsServiceV2Client(metricsServiceV2Client); +} + +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 00000000..c8f81b25 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts new file mode 100644 index 00000000..1d67fad1 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts @@ -0,0 +1,6220 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as configservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ConfigServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = configservicev2Module.v2.ConfigServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.configServiceV2Stub, undefined); + await client.initialize(); + assert(client.configServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.configServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.configServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + 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 configservicev2Module.v2.ConfigServiceV2Client({ + 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('getBucket', () => { + it('invokes getBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); + const [response] = await client.getBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBucket(request), expectedError); + }); + }); + + describe('createBucket', () => { + it('invokes createBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); + const [response] = await client.createBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBucket(request), expectedError); + }); + }); + + describe('updateBucket', () => { + it('invokes updateBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); + const [response] = await client.updateBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBucket(request), expectedError); + }); + }); + + describe('deleteBucket', () => { + it('invokes deleteBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBucket( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBucket(request), expectedError); + }); + }); + + describe('undeleteBucket', () => { + it('invokes undeleteBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); + const [response] = await client.undeleteBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeleteBucket( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.undeleteBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.undeleteBucket(request), expectedError); + }); + }); + + describe('getView', () => { + it('invokes getView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.getView = stubSimpleCall(expectedResponse); + const [response] = await client.getView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getView(request), expectedError); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getView(request), expectedError); + }); + }); + + describe('createView', () => { + it('invokes createView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.createView = stubSimpleCall(expectedResponse); + const [response] = await client.createView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createView(request), expectedError); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createView(request), expectedError); + }); + }); + + describe('updateView', () => { + it('invokes updateView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); + const [response] = await client.updateView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateView(request), expectedError); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateView(request), expectedError); + }); + }); + + describe('deleteView', () => { + it('invokes deleteView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); + const [response] = await client.deleteView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteView( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteView(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteView(request), expectedError); + }); + }); + + describe('getSink', () => { + it('invokes getSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); + const [response] = await client.getSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSink(request), expectedError); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSink(request), expectedError); + }); + }); + + describe('createSink', () => { + it('invokes createSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); + const [response] = await client.createSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSink(request), expectedError); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSink(request), expectedError); + }); + }); + + describe('updateSink', () => { + it('invokes updateSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); + const [response] = await client.updateSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSink(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSink(request), expectedError); + }); + }); + + describe('deleteSink', () => { + it('invokes deleteSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSink( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSink(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSink(request), expectedError); + }); + }); + + describe('getLink', () => { + it('invokes getLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Link() + ); + client.innerApiCalls.getLink = stubSimpleCall(expectedResponse); + const [response] = await client.getLink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Link() + ); + client.innerApiCalls.getLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLink(request), expectedError); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLink(request), expectedError); + }); + }); + + describe('getExclusion', () => { + it('invokes getExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.getExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExclusion(request), expectedError); + }); + }); + + describe('createExclusion', () => { + it('invokes createExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.createExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExclusion(request), expectedError); + }); + }); + + describe('updateExclusion', () => { + it('invokes updateExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.updateExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateExclusion(request), expectedError); + }); + }); + + describe('deleteExclusion', () => { + it('invokes deleteExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteExclusion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteExclusion(request), expectedError); + }); + }); + + describe('getCmekSettings', () => { + it('invokes getCmekSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getCmekSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCmekSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCmekSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCmekSettings(request), expectedError); + }); + }); + + describe('updateCmekSettings', () => { + it('invokes updateCmekSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateCmekSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCmekSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCmekSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCmekSettings(request), expectedError); + }); + }); + + describe('getSettings', () => { + it('invokes getSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSettings(request), expectedError); + }); + }); + + describe('updateSettings', () => { + it('invokes updateSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSettings(request), expectedError); + }); + }); + + describe('createBucketAsync', () => { + it('invokes createBucketAsync without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBucketAsync(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBucketAsync = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBucketAsync( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBucketAsync(request), expectedError); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBucketAsync(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBucketAsyncProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBucketAsyncProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBucketAsyncProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBucketAsyncProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBucketAsync', () => { + it('invokes updateBucketAsync without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBucketAsync(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBucketAsync = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBucketAsync( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBucketAsync(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBucketAsync(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateBucketAsyncProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateBucketAsyncProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBucketAsyncProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateBucketAsyncProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createLink', () => { + it('invokes createLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createLink = stubLongRunningCall(expectedResponse); + const [operation] = await client.createLink(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createLink = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createLink( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLink = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createLink(request), expectedError); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLink = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createLink(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateLinkProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateLinkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateLinkProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateLinkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteLink', () => { + it('invokes deleteLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteLink = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteLink(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteLink = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLink( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteLink(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteLink(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteLinkProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteLinkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteLinkProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteLinkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('copyLogEntries', () => { + it('invokes copyLogEntries without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); + const [operation] = await client.copyLogEntries(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes copyLogEntries without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.copyLogEntries( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes copyLogEntries with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.copyLogEntries(request), expectedError); + }); + + it('invokes copyLogEntries with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.copyLogEntries(request); + await assert.rejects(operation.promise(), expectedError); + }); + + it('invokes checkCopyLogEntriesProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCopyLogEntriesProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBuckets', () => { + it('invokes listBuckets without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); + const [response] = await client.listBuckets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuckets without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuckets( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuckets with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuckets(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBucketsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBucketsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogBucket[] = []; + stream.on('data', (response: protos.google.logging.v2.LogBucket) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); + assert( + (client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBucketsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBucketsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogBucket[] = []; + stream.on('data', (response: protos.google.logging.v2.LogBucket) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); + assert( + (client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuckets without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogBucket[] = []; + const iterable = client.listBucketsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuckets with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBucketsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogBucket[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listViews', () => { + it('invokes listViews without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); + const [response] = await client.listViews(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViews without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listViews( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViews with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listViews(request), expectedError); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViewsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listViewsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogView[] = []; + stream.on('data', (response: protos.google.logging.v2.LogView) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listViews, request)); + assert( + (client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listViewsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listViewsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogView[] = []; + stream.on('data', (response: protos.google.logging.v2.LogView) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listViews, request)); + assert( + (client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listViews without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogView[] = []; + const iterable = client.listViewsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listViews with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listViewsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogView[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSinks', () => { + it('invokes listSinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); + const [response] = await client.listSinks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinks without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSinks( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSinks(request), expectedError); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinksStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogSink[] = []; + stream.on('data', (response: protos.google.logging.v2.LogSink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); + assert( + (client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSinksStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogSink[] = []; + stream.on('data', (response: protos.google.logging.v2.LogSink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); + assert( + (client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogSink[] = []; + const iterable = client.listSinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogSink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listLinks', () => { + it('invokes listLinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.innerApiCalls.listLinks = stubSimpleCall(expectedResponse); + const [response] = await client.listLinks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinks without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.innerApiCalls.listLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLinks( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLinks(request), expectedError); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinksStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.descriptors.page.listLinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.Link[] = []; + stream.on('data', (response: protos.google.logging.v2.Link) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); + assert( + (client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLinksStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.Link[] = []; + stream.on('data', (response: protos.google.logging.v2.Link) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); + assert( + (client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILink[] = []; + const iterable = client.listLinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listExclusions', () => { + it('invokes listExclusions without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); + const [response] = await client.listExclusions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusions without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExclusions( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusions with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExclusions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusionsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExclusionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogExclusion[] = []; + stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); + assert( + (client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExclusionsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExclusionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogExclusion[] = []; + stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); + assert( + (client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExclusions without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogExclusion[] = []; + const iterable = client.listExclusionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExclusions with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExclusionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogExclusion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts new file mode 100644 index 00000000..268928df --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts @@ -0,0 +1,2415 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as loggingservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubBidiStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.LoggingServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.loggingServiceV2Stub, undefined); + await client.initialize(); + assert(client.loggingServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.loggingServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.loggingServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + 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 loggingservicev2Module.v2.LoggingServiceV2Client({ + 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('deleteLog', () => { + it('invokes deleteLog without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); + const [response] = await client.deleteLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLog( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteLog(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog with closed client', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteLog(request), expectedError); + }); + }); + + describe('writeLogEntries', () => { + it('invokes writeLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesResponse() + ); + client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); + const [response] = await client.writeLogEntries(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes writeLogEntries without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesResponse() + ); + client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.writeLogEntries( + request, + (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes writeLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.writeLogEntries(request), expectedError); + }); + + it('invokes writeLogEntries with closed client', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.writeLogEntries(request), expectedError); + }); + }); + + describe('tailLogEntries', () => { + it('invokes tailLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesResponse() + ); + client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); + const stream = client.tailLogEntries(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.tailLogEntries as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes tailLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); + const stream = client.tailLogEntries(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.tailLogEntries as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + describe('listLogEntries', () => { + it('invokes listLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); + const [response] = await client.listLogEntries(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listLogEntries without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogEntries( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogEntries(request), expectedError); + }); + + it('invokes listLogEntriesStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogEntriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogEntry[] = []; + stream.on('data', (response: protos.google.logging.v2.LogEntry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogEntries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); + }); + + it('invokes listLogEntriesStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogEntriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogEntry[] = []; + stream.on('data', (response: protos.google.logging.v2.LogEntry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogEntries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); + }); + + it('uses async iteration with listLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogEntry[] = []; + const iterable = client.listLogEntriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogEntriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogEntry[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listMonitoredResourceDescriptors', () => { + it('invokes listMonitoredResourceDescriptors without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); + const [response] = await client.listMonitoredResourceDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listMonitoredResourceDescriptors without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMonitoredResourceDescriptors( + request, + (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listMonitoredResourceDescriptors with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); + }); + + it('invokes listMonitoredResourceDescriptorsStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); + }); + + it('invokes listMonitoredResourceDescriptorsStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); + }); + + it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listLogs', () => { + it('invokes listLogs without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); + const [response] = await client.listLogs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogs without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogs( + request, + (err?: Error|null, result?: string[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogs with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogs(request), expectedError); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogsStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); + assert( + (client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLogsStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); + assert( + (client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogs without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.listLogsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogs with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts new file mode 100644 index 00000000..6904bceb --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts @@ -0,0 +1,2257 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as metricsservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.MetricsServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsServiceV2Stub, undefined); + await client.initialize(); + assert(client.metricsServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.metricsServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + 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 metricsservicev2Module.v2.MetricsServiceV2Client({ + 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('getLogMetric', () => { + it('invokes getLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.getLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLogMetric(request), expectedError); + }); + }); + + describe('createLogMetric', () => { + it('invokes createLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.createLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createLogMetric(request), expectedError); + }); + }); + + describe('updateLogMetric', () => { + it('invokes updateLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.updateLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateLogMetric(request), expectedError); + }); + }); + + describe('deleteLogMetric', () => { + it('invokes deleteLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.deleteLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLogMetric( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteLogMetric(request), expectedError); + }); + }); + + describe('listLogMetrics', () => { + it('invokes listLogMetrics without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); + const [response] = await client.listLogMetrics(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetrics without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogMetrics( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetrics with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogMetrics(request), expectedError); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetricsStream without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogMetricsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogMetric[] = []; + stream.on('data', (response: protos.google.logging.v2.LogMetric) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); + assert( + (client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLogMetricsStream with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogMetricsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogMetric[] = []; + stream.on('data', (response: protos.google.logging.v2.LogMetric) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); + assert( + (client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogMetrics without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogMetric[] = []; + const iterable = client.listLogMetricsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogMetrics with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogMetricsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogMetric[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /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 00000000..a37e80e5 --- /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: 'logging', + filename: './logging.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 986ee1514140289510084bc6c42b680646dad76b Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 19:58:58 +0000 Subject: [PATCH 2/5] =?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/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/package.json | 60 - .../protos/google/logging/v2/log_entry.proto | 280 - .../v2/protos/google/logging/v2/logging.proto | 483 -- .../google/logging/v2/logging_config.proto | 2317 ------ .../google/logging/v2/logging_metrics.proto | 339 - .../v2/config_service_v2.copy_log_entries.js | 74 - .../v2/config_service_v2.create_bucket.js | 78 - .../config_service_v2.create_bucket_async.js | 79 - .../v2/config_service_v2.create_exclusion.js | 74 - .../v2/config_service_v2.create_link.js | 78 - .../v2/config_service_v2.create_sink.js | 88 - .../v2/config_service_v2.create_view.js | 76 - .../v2/config_service_v2.delete_bucket.js | 67 - .../v2/config_service_v2.delete_exclusion.js | 67 - .../v2/config_service_v2.delete_link.js | 66 - .../v2/config_service_v2.delete_sink.js | 68 - .../v2/config_service_v2.delete_view.js | 64 - .../v2/config_service_v2.get_bucket.js | 67 - .../v2/config_service_v2.get_cmek_settings.js | 71 - .../v2/config_service_v2.get_exclusion.js | 67 - .../v2/config_service_v2.get_link.js | 65 - .../v2/config_service_v2.get_settings.js | 71 - .../v2/config_service_v2.get_sink.js | 67 - .../v2/config_service_v2.get_view.js | 64 - .../v2/config_service_v2.list_buckets.js | 83 - .../v2/config_service_v2.list_exclusions.js | 80 - .../v2/config_service_v2.list_links.js | 77 - .../v2/config_service_v2.list_sinks.js | 80 - .../v2/config_service_v2.list_views.js | 77 - .../v2/config_service_v2.undelete_bucket.js | 67 - .../v2/config_service_v2.update_bucket.js | 82 - .../config_service_v2.update_bucket_async.js | 83 - .../config_service_v2.update_cmek_settings.js | 86 - .../v2/config_service_v2.update_exclusion.js | 84 - .../v2/config_service_v2.update_settings.js | 83 - .../v2/config_service_v2.update_sink.js | 101 - .../v2/config_service_v2.update_view.js | 78 - .../v2/logging_service_v2.delete_log.js | 70 - .../v2/logging_service_v2.list_log_entries.js | 106 - .../v2/logging_service_v2.list_logs.js | 94 - ..._v2.list_monitored_resource_descriptors.js | 71 - .../v2/logging_service_v2.tail_log_entries.js | 89 - .../logging_service_v2.write_log_entries.js | 129 - .../metrics_service_v2.create_log_metric.js | 69 - .../metrics_service_v2.delete_log_metric.js | 62 - .../v2/metrics_service_v2.get_log_metric.js | 62 - .../v2/metrics_service_v2.list_log_metrics.js | 77 - .../metrics_service_v2.update_log_metric.js | 70 - .../snippet_metadata_google.logging.v2.json | 1963 ------ owl-bot-staging/v2/src/index.ts | 29 - .../v2/src/v2/config_service_v2_client.ts | 5530 --------------- .../v2/config_service_v2_client_config.json | 169 - .../src/v2/config_service_v2_proto_list.json | 8 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 512 -- owl-bot-staging/v2/src/v2/index.ts | 21 - .../v2/src/v2/logging_service_v2_client.ts | 2754 -------- .../v2/logging_service_v2_client_config.json | 67 - .../src/v2/logging_service_v2_proto_list.json | 8 - .../v2/src/v2/metrics_service_v2_client.ts | 2288 ------ .../v2/metrics_service_v2_client_config.json | 56 - .../src/v2/metrics_service_v2_proto_list.json | 8 - .../system-test/fixtures/sample/src/index.js | 29 - .../system-test/fixtures/sample/src/index.ts | 44 - owl-bot-staging/v2/system-test/install.ts | 49 - .../v2/test/gapic_config_service_v2_v2.ts | 6220 ----------------- .../v2/test/gapic_logging_service_v2_v2.ts | 2415 ------- .../v2/test/gapic_metrics_service_v2_v2.ts | 2257 ------ owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 - src/v2/config_service_v2_client.ts | 9 +- src/v2/logging_service_v2_client.ts | 9 +- src/v2/metrics_service_v2_client.ts | 7 +- 79 files changed, 11 insertions(+), 31449 deletions(-) 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/package.json delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_metrics.proto delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json delete mode 100644 owl-bot-staging/v2/src/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json 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/logging_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_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_config_service_v2_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_metrics_service_v2_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/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- 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 78215349..00000000 --- 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 d4f03a0d..00000000 --- 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 9e6e0612..00000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/logging', - 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 1a38f257..00000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js deleted file mode 100644 index 55639e70..00000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md deleted file mode 100644 index bdf6f36e..00000000 --- a/owl-bot-staging/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Logging: Nodejs Client diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index b670cd57..00000000 --- a/owl-bot-staging/v2/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@google-cloud/logging", - "version": "0.1.0", - "description": "Logging client for Node.js", - "repository": "googleapis/nodejs-logging", - "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 logging", - "logging", - "config service v2", - "logging service v2", - "metrics service v2" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto deleted file mode 100644 index 94c5cdff..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/type/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 cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// An individual entry in a log. -message LogEntry { - option (google.api.resource) = { - type: "logging.googleapis.com/Log" - pattern: "projects/{project}/logs/{log}" - pattern: "organizations/{organization}/logs/{log}" - pattern: "folders/{folder}/logs/{log}" - pattern: "billingAccounts/{billing_account}/logs/{log}" - name_field: "log_name" - }; - - // Required. The resource name of the log to which this log entry belongs: - // - // "projects/[PROJECT_ID]/logs/[LOG_ID]" - // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - // "folders/[FOLDER_ID]/logs/[LOG_ID]" - // - // A project number may be used in place of PROJECT_ID. The project number is - // translated to its corresponding PROJECT_ID internally and the `log_name` - // field will contain PROJECT_ID in queries and exports. - // - // `[LOG_ID]` must be URL-encoded within `log_name`. Example: - // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - // - // `[LOG_ID]` must be less than 512 characters long and can only include the - // following characters: upper and lower case alphanumeric characters, - // forward-slash, underscore, hyphen, and period. - // - // For backward compatibility, if `log_name` begins with a forward-slash, such - // as `/projects/...`, then the log entry is ingested as usual, but the - // forward-slash is removed. Listing the log entry will not show the leading - // slash and filtering for a log name with a leading slash will never return - // any results. - string log_name = 12 [(google.api.field_behavior) = REQUIRED]; - - // Required. The monitored resource that produced this log entry. - // - // Example: a log entry that reports a database error would be associated with - // the monitored resource designating the particular database that reported - // the error. - google.api.MonitoredResource resource = 8 - [(google.api.field_behavior) = REQUIRED]; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer. Some Google - // Cloud Platform services use this field for their log entry payloads. - // - // The following protocol buffer types are supported; user-defined types - // are not supported: - // - // "type.googleapis.com/google.cloud.audit.AuditLog" - // "type.googleapis.com/google.appengine.logging.v1.RequestLog" - 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 json_payload = 6; - } - - // Optional. The time the event described by the log entry occurred. This time - // is used to compute the log entry's age and to enforce the logs retention - // period. If this field is omitted in a new log entry, then Logging assigns - // it the current time. Timestamps have nanosecond accuracy, but trailing - // zeros in the fractional seconds might be omitted when the timestamp is - // displayed. - // - // Incoming log entries must have timestamps that don't exceed the - // [logs retention - // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in - // the past, and that don't exceed 24 hours in the future. Log entries outside - // those time boundaries aren't ingested by Logging. - google.protobuf.Timestamp timestamp = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time the log entry was received by Logging. - google.protobuf.Timestamp receive_timestamp = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The severity of the log entry. The default value is - // `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique identifier for the log entry. If you provide a value, - // then Logging considers other log entries in the same project, with the same - // `timestamp`, and with the same `insert_id` to be duplicates which are - // removed in a single query result. However, there are no guarantees of - // de-duplication in the export of logs. - // - // If the `insert_id` is omitted when writing a log entry, the Logging API - // assigns its own unique identifier in this field. - // - // In queries, the `insert_id` is also used to order log entries that have - // the same `log_name` and `timestamp` values. - string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about the HTTP request associated with this log - // entry, if applicable. - google.logging.type.HttpRequest http_request = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map of key, value pairs that provides additional information - // about the log entry. The labels can be user-defined or system-defined. - // - // User-defined labels are arbitrary key, value pairs that you can use to - // classify logs. - // - // System-defined labels are defined by GCP services for platform logs. - // They have two components - a service namespace component and the - // attribute name. For example: `compute.googleapis.com/resource_name`. - // - // Cloud Logging truncates label keys that exceed 512 B and label - // values that exceed 64 KB upon their associated log entry being - // written. The truncation is indicated by an ellipsis at the - // end of the character string. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about an operation associated with the log entry, if - // applicable. - LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The REST resource name of the trace being written to - // [Cloud Trace](https://cloud.google.com/trace) in - // association with this log entry. For example, if your trace data is stored - // in the Cloud project "my-trace-project" and if the service that is creating - // the log entry receives a trace header that includes the trace ID "12345", - // then the service should use "projects/my-tracing-project/traces/12345". - // - // The `trace` field provides the link between logs and traces. By using - // this field, you can navigate from a log entry to a trace. - string trace = 22 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span - // associated with the current operation in which the log is being written. - // For example, if a span has the REST resource name of - // "projects/some-project/traces/some-trace/spans/some-span-id", then the - // `span_id` field is "some-span-id". - // - // A - // [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span) - // represents a single operation within a trace. Whereas a trace may involve - // multiple different microservices running on multiple different machines, - // a span generally corresponds to a single logical operation being performed - // in a single instance of a microservice on one specific machine. Spans - // are the nodes within the tree that is a trace. - // - // Applications that are [instrumented for - // tracing](https://cloud.google.com/trace/docs/setup) will generally assign a - // new, unique span ID on each incoming request. It is also common to create - // and record additional spans corresponding to internal processing elements - // as well as issuing requests to dependencies. - // - // The span ID is expected to be a 16-character, hexadecimal encoding of an - // 8-byte array and should not be zero. It should be unique within the trace - // and should, ideally, be generated in a manner that is uniformly random. - // - // Example values: - // - // - `000000000000004a` - // - `7a2190356c3fc94b` - // - `0000f00300090021` - // - `d39223e101960076` - string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sampling decision of the trace associated with the log entry. - // - // True means that the trace resource name in the `trace` field was sampled - // for storage in a trace backend. False means that the trace was not sampled - // for storage when this log entry was written, or the sampling decision was - // unknown at the time. A non-sampled `trace` value is still useful as a - // request correlation identifier. The default is False. - bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Source code location information associated with the log entry, - // if any. - LogEntrySourceLocation source_location = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information indicating this LogEntry is part of a sequence of - // multiple log entries split from a single LogEntry. - LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; -} - -// 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 [(google.api.field_behavior) = OPTIONAL]; - - // 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 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the first log entry in the operation. - bool first = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the last log entry in the operation. - bool last = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// 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 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Line within the source file. 1-based; 0 indicates no line number - // available. - int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information used to correlate multiple log entries. Used when a -// single LogEntry would exceed the Google Cloud Logging size limit and is -// split across multiple log entries. -message LogSplit { - // A globally unique identifier for all log entries in a sequence of split log - // entries. All log entries with the same |LogSplit.uid| are assumed to be - // part of the same sequence of split log entries. - string uid = 1; - - // The index of this LogEntry in the sequence of split log entries. Log - // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log - // entries. - int32 index = 2; - - // The total number of log entries that the original LogEntry was split into. - int32 total_splits = 3; -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto deleted file mode 100644 index 92d481ea..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/v2/log_entry.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// Service for ingesting and querying logs. -service LoggingServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read," - "https://www.googleapis.com/auth/logging.write"; - - // Deletes all the log entries in a log for the _Default Log Bucket. The log - // reappears if it receives new entries. Log entries written shortly before - // the delete operation might not be deleted. Entries received after the - // delete operation with a timestamp before the operation will be deleted. - rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{log_name=projects/*/logs/*}" - additional_bindings { delete: "/v2/{log_name=*/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=organizations/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=folders/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=billingAccounts/*/logs/*}" } - }; - option (google.api.method_signature) = "log_name"; - } - - // Writes log entries to Logging. This API method is the - // only way to send log entries to Logging. This method - // is used, directly or indirectly, by the Logging agent - // (fluentd) and all logging libraries configured to use Logging. - // A single request may contain log entries for a maximum of 1000 - // different resources (projects, organizations, billing accounts or - // folders) - rpc WriteLogEntries(WriteLogEntriesRequest) - returns (WriteLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:write" - body: "*" - }; - option (google.api.method_signature) = "log_name,resource,labels,entries"; - } - - // Lists log entries. Use this method to retrieve log entries that originated - // from a project/folder/organization/billing account. For ways to export log - // entries, see [Exporting - // Logs](https://cloud.google.com/logging/docs/export). - rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:list" - body: "*" - }; - option (google.api.method_signature) = "resource_names,filter,order_by"; - } - - // Lists the descriptors for monitored resource types used by Logging. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) - returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v2/monitoredResourceDescriptors" - }; - } - - // Lists the logs in projects, organizations, folders, or billing accounts. - // Only logs that have entries are listed. - rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/logs" - additional_bindings { get: "/v2/{parent=projects/*}/logs" } - additional_bindings { get: "/v2/{parent=organizations/*}/logs" } - additional_bindings { get: "/v2/{parent=folders/*}/logs" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/logs" } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Streaming read of log entries as they are ingested. Until the stream is - // terminated, it will continue reading logs. - rpc TailLogEntries(stream TailLogEntriesRequest) - returns (stream TailLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:tail" - body: "*" - }; - } -} - -// The parameters to DeleteLog. -message DeleteLogRequest { - // Required. The resource name of the log to delete: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example, - // `"projects/my-project-id/logs/syslog"`, - // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - // - // For more information about log names, see - // [LogEntry][google.logging.v2.LogEntry]. - string log_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } - ]; -} - -// The parameters to WriteLogEntries. -message WriteLogEntriesRequest { - // Optional. A default log resource name that is assigned to all log entries - // in `entries` that do not specify a value for `log_name`: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example: - // - // "projects/my-project-id/logs/syslog" - // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - // - // The permission `logging.logEntries.create` is needed on each project, - // organization, billing account, or folder that is receiving new log - // entries, whether the resource is specified in `logName` or in an - // individual log entry. - string log_name = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } - ]; - - // Optional. A default monitored resource object that is assigned to all log - // entries in `entries` that do not specify a value for `resource`. Example: - // - // { "type": "gce_instance", - // "labels": { - // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - // - // See [LogEntry][google.logging.v2.LogEntry]. - google.api.MonitoredResource resource = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Default labels that are added to the `labels` field of all log - // entries in `entries`. If a log entry already has a label with the same key - // as a label in this parameter, then the log entry's label is not changed. - // See [LogEntry][google.logging.v2.LogEntry]. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The log entries to send to Logging. The order of log - // entries in this list does not matter. Values supplied in this method's - // `log_name`, `resource`, and `labels` fields are copied into those log - // entries in this list that do not include values for their corresponding - // fields. For more information, see the - // [LogEntry][google.logging.v2.LogEntry] type. - // - // If the `timestamp` or `insert_id` fields are missing in log entries, then - // this method supplies the current time or a unique identifier, respectively. - // The supplied values are chosen so that, among the log entries that did not - // supply their own values, the entries earlier in the list will sort before - // the entries later in the list. See the `entries.list` method. - // - // Log entries with timestamps that are more than the - // [logs retention period](https://cloud.google.com/logging/quotas) in - // the past or more than 24 hours in the future will not be available when - // calling `entries.list`. However, those log entries can still be [exported - // with - // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - // - // To improve throughput and to avoid exceeding the - // [quota limit](https://cloud.google.com/logging/quotas) for calls to - // `entries.write`, you should try to include several log entries in this - // list, rather than calling this method for each individual log entry. - repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether a batch's valid entries should be written even if some - // other entry failed due to a permanent error such as INVALID_ARGUMENT or - // PERMISSION_DENIED. If any entry failed, then the response status is the - // response status of one of the failed entries. The response will include - // error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - // the entries' zero-based index in the `entries`. Failed requests for which - // no entries are written will not include per-entry errors. - bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the request should expect normal response, but the - // entries won't be persisted nor exported. Useful for checking whether the - // logging API endpoints are working properly before sending valuable data. - bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from WriteLogEntries. -message WriteLogEntriesResponse {} - -// Error details for WriteLogEntries with partial success. -message WriteLogEntriesPartialErrors { - // When `WriteLogEntriesRequest.partial_success` is true, records the error - // status for entries that were not written due to a permanent error, keyed - // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. - // - // Failed requests for which no entries are written will not include - // per-entry errors. - map log_entry_errors = 1; -} - -// The parameters to `ListLogEntries`. -message ListLogEntriesRequest { - // Required. Names of one or more parent resources from which to - // retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // Projects listed in the `project_ids` field are added to this list. - // A maximum of 100 resources may be specified in a single request. - repeated string resource_names = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. Only log entries that match the filter are returned. An empty - // filter matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of a filter is - // 20,000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. How the results should be sorted. Presently, the only permitted - // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - // option returns entries in order of increasing values of - // `LogEntry.timestamp` (oldest first), and the second option returns entries - // in order of decreasing timestamps (newest first). Entries with equal - // timestamps are returned in order of their `insert_id` values. - string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Default is 50. If the value is negative or exceeds 1000, the request is - // rejected. The presence of `next_page_token` in the response indicates that - // more results might be available. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `page_token` must be the value of - // `next_page_token` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListLogEntries`. -message ListLogEntriesResponse { - // A list of log entries. If `entries` is empty, `nextPageToken` may still be - // returned, indicating that more entries may exist. See `nextPageToken` for - // more information. - repeated LogEntry entries = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - // - // If a value for `next_page_token` appears and the `entries` field is empty, - // it means that the search found no log entries so far but it did not have - // time to search all the possible log entries. Retry the method with this - // value for `page_token` to continue the search. Alternatively, consider - // speeding up the search by changing your filter to specify a single log name - // or resource type, or to narrow the time range of the search. - string next_page_token = 2; -} - -// The parameters to ListMonitoredResourceDescriptors -message ListMonitoredResourceDescriptorsRequest { - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListMonitoredResourceDescriptors. -message ListMonitoredResourceDescriptorsResponse { - // A list of resource descriptors. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to ListLogs. -message ListLogsRequest { - // Required. The resource name to list logs for: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. List of resource names to list logs for: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // To support legacy queries, it could also be: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // The resource name in the `parent` field is added to this list. - repeated string resource_names = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogs. -message ListLogsResponse { - // A list of log names. For example, - // `"projects/my-project/logs/syslog"` or - // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - repeated string log_names = 3; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `TailLogEntries`. -message TailLogEntriesRequest { - // Required. Name of a parent resource from which to retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Only log entries that match the filter are returned. An empty - // filter matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of a filter is - // 20,000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The amount of time to buffer log entries at the server before - // being returned to prevent out of order results due to late arriving log - // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - // milliseconds. - google.protobuf.Duration buffer_window = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `TailLogEntries`. -message TailLogEntriesResponse { - // Information about entries that were omitted from the session. - message SuppressionInfo { - // An indicator of why entries were omitted. - enum Reason { - // Unexpected default. - REASON_UNSPECIFIED = 0; - - // Indicates suppression occurred due to relevant entries being - // received in excess of rate limits. For quotas and limits, see - // [Logging API quotas and - // limits](https://cloud.google.com/logging/quotas#api-limits). - RATE_LIMIT = 1; - - // Indicates suppression occurred due to the client not consuming - // responses quickly enough. - NOT_CONSUMED = 2; - } - - // The reason that entries were omitted from the session. - Reason reason = 1; - - // A lower bound on the count of entries omitted due to `reason`. - int32 suppressed_count = 2; - } - - // A list of log entries. Each response in the stream will order entries with - // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed - // between separate responses. - repeated LogEntry entries = 1; - - // If entries that otherwise would have been included in the session were not - // sent back to the client, counts of relevant entries omitted from the - // session with the reason that they were not included. There will be at most - // one of each reason per response. The counts represent the number of - // suppressed entries since the last streamed response. - repeated SuppressionInfo suppression_info = 2; -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto deleted file mode 100644 index cc7677b1..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto +++ /dev/null @@ -1,2317 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LoggingConfigProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/OrganizationLocation" - pattern: "organizations/{organization}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/FolderLocation" - pattern: "folders/{folder}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/BillingAccountLocation" - pattern: "billingAccounts/{billing_account}/locations/{location}" -}; - -// Service for configuring sinks used to route log entries. -service ConfigServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read"; - - // Lists log buckets. - rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*}/buckets" - additional_bindings { get: "/v2/{parent=projects/*/locations/*}/buckets" } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/buckets" - } - additional_bindings { get: "/v2/{parent=folders/*/locations/*}/buckets" } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a log bucket. - rpc GetBucket(GetBucketRequest) returns (LogBucket) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { get: "/v2/{name=projects/*/locations/*/buckets/*}" } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { get: "/v2/{name=folders/*/locations/*/buckets/*}" } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Creates a log bucket asynchronously that can be used to store log entries. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc CreateBucketAsync(CreateBucketRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets:createAsync" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync" - body: "bucket" - } - }; - option (google.longrunning.operation_info) = { - response_type: "LogBucket" - metadata_type: "BucketMetadata" - }; - } - - // Updates a log bucket asynchronously. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucketAsync(UpdateBucketRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - }; - option (google.longrunning.operation_info) = { - response_type: "LogBucket" - metadata_type: "BucketMetadata" - }; - } - - // Creates a log bucket that can be used to store log entries. After a bucket - // has been created, the bucket's location cannot be changed. - rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - body: "bucket" - } - }; - } - - // Updates a log bucket. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*}" - body: "bucket" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - body: "bucket" - } - }; - } - - // Deletes a log bucket. - // - // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - // After 7 days, the bucket will be purged and all log entries in the bucket - // will be permanently deleted. - rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Undeletes a log bucket. A bucket that has been deleted can be undeleted - // within the grace period of 7 days. - rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" - body: "*" - } - }; - } - - // Lists views on a log bucket. - rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/views" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a view on a log bucket.. - rpc GetView(GetViewRequest) returns (LogView) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Creates a view over log entries in a log bucket. A bucket may contain a - // maximum of 30 views. - rpc CreateView(CreateViewRequest) returns (LogView) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/views" - body: "view" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - body: "view" - } - }; - } - - // Updates a view on a log bucket. This method replaces the following fields - // in the existing view with values from the new view: `filter`. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can update the view. If this occurs, please try again in a - // few minutes. - rpc UpdateView(UpdateViewRequest) returns (LogView) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - body: "view" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - body: "view" - } - }; - } - - // Deletes a view on a log bucket. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can delete the view. If this occurs, please try again in a - // few minutes. - rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Lists sinks. - rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/sinks" - additional_bindings { get: "/v2/{parent=projects/*}/sinks" } - additional_bindings { get: "/v2/{parent=organizations/*}/sinks" } - additional_bindings { get: "/v2/{parent=folders/*}/sinks" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/sinks" } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a sink. - rpc GetSink(GetSinkRequest) returns (LogSink) { - option (google.api.http) = { - get: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { get: "/v2/{sink_name=projects/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=organizations/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=folders/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=billingAccounts/*/sinks/*}" } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Creates a sink that exports specified log entries to a destination. The - // export of newly-ingested log entries begins immediately, unless the sink's - // `writer_identity` is not permitted to write to the destination. A sink can - // export log entries only from the resource owning the sink. - rpc CreateSink(CreateSinkRequest) returns (LogSink) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/sinks" - body: "sink" - additional_bindings { post: "/v2/{parent=projects/*}/sinks" body: "sink" } - additional_bindings { - post: "/v2/{parent=organizations/*}/sinks" - body: "sink" - } - additional_bindings { post: "/v2/{parent=folders/*}/sinks" body: "sink" } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/sinks" - body: "sink" - } - }; - option (google.api.method_signature) = "parent,sink"; - } - - // Updates a sink. This method replaces the following fields in the existing - // sink with values from the new sink: `destination`, and `filter`. - // - // The updated sink might also have a new `writer_identity`; see the - // `unique_writer_identity` field. - rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { - option (google.api.http) = { - put: "/v2/{sink_name=*/*/sinks/*}" - body: "sink" - additional_bindings { - put: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - }; - option (google.api.method_signature) = "sink_name,sink,update_mask"; - option (google.api.method_signature) = "sink_name,sink"; - } - - // Deletes a sink. If the sink has a unique `writer_identity`, then that - // service account is also deleted. - rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { delete: "/v2/{sink_name=projects/*/sinks/*}" } - additional_bindings { delete: "/v2/{sink_name=organizations/*/sinks/*}" } - additional_bindings { delete: "/v2/{sink_name=folders/*/sinks/*}" } - additional_bindings { - delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Asynchronously creates a linked dataset in BigQuery which makes it possible - // to use BigQuery to read the logs stored in the log bucket. A log bucket may - // currently only contain one link. - rpc CreateLink(CreateLinkRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/links" - body: "link" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" - body: "link" - } - }; - option (google.api.method_signature) = "parent,link,link_id"; - option (google.longrunning.operation_info) = { - response_type: "Link" - metadata_type: "LinkMetadata" - }; - } - - // Deletes a link. This will also delete the corresponding BigQuery linked - // dataset. - rpc DeleteLink(DeleteLinkRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/links/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "LinkMetadata" - }; - } - - // Lists links. - rpc ListLinks(ListLinksRequest) returns (ListLinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/links" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a link. - rpc GetLink(GetLinkRequest) returns (Link) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/links/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists all the exclusions on the _Default sink in a parent resource. - rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/exclusions" - additional_bindings { get: "/v2/{parent=projects/*}/exclusions" } - additional_bindings { get: "/v2/{parent=organizations/*}/exclusions" } - additional_bindings { get: "/v2/{parent=folders/*}/exclusions" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/exclusions" } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the description of an exclusion in the _Default sink. - rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - get: "/v2/{name=*/*/exclusions/*}" - additional_bindings { get: "/v2/{name=projects/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=organizations/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=folders/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=billingAccounts/*/exclusions/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new exclusion in the _Default sink in a specified parent - // resource. Only log entries belonging to that resource can be excluded. You - // can have up to 10 exclusions in a resource. - rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/exclusions" - body: "exclusion" - additional_bindings { - post: "/v2/{parent=projects/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=folders/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/exclusions" - body: "exclusion" - } - }; - option (google.api.method_signature) = "parent,exclusion"; - } - - // Changes one or more properties of an existing exclusion in the _Default - // sink. - rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - patch: "/v2/{name=*/*/exclusions/*}" - body: "exclusion" - additional_bindings { - patch: "/v2/{name=projects/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=organizations/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=folders/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/exclusions/*}" - body: "exclusion" - } - }; - option (google.api.method_signature) = "name,exclusion,update_mask"; - } - - // Deletes an exclusion in the _Default sink. - rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/exclusions/*}" - additional_bindings { delete: "/v2/{name=projects/*/exclusions/*}" } - additional_bindings { delete: "/v2/{name=organizations/*/exclusions/*}" } - additional_bindings { delete: "/v2/{name=folders/*/exclusions/*}" } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the Logging CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can be configured for Google Cloud projects, - // folders, organizations and billing accounts. Once configured for an - // organization, it applies to all projects and folders in the Google Cloud - // organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/cmekSettings" - additional_bindings { get: "/v2/{name=projects/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=organizations/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=folders/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=billingAccounts/*}/cmekSettings" } - }; - } - - // Updates the Log Router CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can currently only be configured for Google - // Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/cmekSettings" - body: "cmek_settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/cmekSettings" - body: "cmek_settings" - } - }; - } - - // Gets the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can be get for Google Cloud projects, - // folders, organizations and billing accounts. Currently it can only be - // configured for organizations. Once configured for an organization, it - // applies to all projects and folders in the Google Cloud organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/settings" - additional_bindings { get: "/v2/{name=projects/*}/settings" } - additional_bindings { get: "/v2/{name=organizations/*}/settings" } - additional_bindings { get: "/v2/{name=folders/*}/settings" } - additional_bindings { get: "/v2/{name=billingAccounts/*}/settings" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can currently only be configured for - // Google Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. 4) `location_id` is not supported by - // Logging. 5) `location_id` violate OrgPolicy. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/settings" - body: "settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/settings" - body: "settings" - } - additional_bindings { - patch: "/v2/{name=folders/*}/settings" - body: "settings" - } - }; - option (google.api.method_signature) = "settings,update_mask"; - } - - // Copies a set of log entries from a log bucket to a Cloud Storage bucket. - rpc CopyLogEntries(CopyLogEntriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/entries:copy" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "CopyLogEntriesResponse" - metadata_type: "CopyLogEntriesMetadata" - }; - } -} - -// Configuration for an indexed field. -message IndexConfig { - // Required. The LogEntry field path to index. - // - // Note that some paths are automatically indexed, and other paths are not - // eligible for indexing. See [indexing documentation]( - // https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields) - // for details. - // - // For example: `jsonPayload.request.status` - string field_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of data in this index. - IndexType type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The timestamp when the index was last modified. - // - // This is used to return the timestamp, and will be ignored if supplied - // during update. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a repository in which log entries are stored. -message LogBucket { - option (google.api.resource) = { - type: "logging.googleapis.com/LogBucket" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" - }; - - // Output only. The resource name of the bucket. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // For a list of supported locations, see [Supported - // Regions](https://cloud.google.com/logging/docs/region-support) - // - // For the location of `global` it is unspecified where log entries are - // actually stored. - // - // After a bucket has been created, the location cannot be changed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describes this bucket. - string description = 3; - - // Output only. The creation timestamp of the bucket. This is not set for any - // of the default buckets. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the bucket. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Logs will be retained by default for this amount of time, after which they - // will automatically be deleted. The minimum retention period is 1 day. If - // this value is set to zero at bucket creation time, the default time of 30 - // days will be used. - int32 retention_days = 11; - - // Whether the bucket is locked. - // - // The retention period on a locked bucket cannot be changed. Locked buckets - // may only be deleted if they are empty. - bool locked = 9; - - // Output only. The bucket lifecycle state. - LifecycleState lifecycle_state = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether log analytics is enabled for this bucket. - // - // Once enabled, log analytics features cannot be disabled. - bool analytics_enabled = 14; - - // Log entry field paths that are denied access in this bucket. - // - // The following fields and their children are eligible: `textPayload`, - // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. - // - // Restricting a repeated field will restrict all values. Adding a parent will - // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) - repeated string restricted_fields = 15; - - // A list of indexed fields and related configuration data. - repeated IndexConfig index_configs = 17; - - // The CMEK settings of the log bucket. If present, new log entries written to - // this log bucket are encrypted using the CMEK key provided in this - // configuration. If a log bucket has CMEK settings, the CMEK settings cannot - // be disabled later by updating the log bucket. Changing the KMS key is - // allowed. - CmekSettings cmek_settings = 19; -} - -// Describes a view over log entries in a bucket. -message LogView { - option (google.api.resource) = { - type: "logging.googleapis.com/LogView" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" - }; - - // The resource name of the view. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` - string name = 1; - - // Describes this view. - string description = 3; - - // Output only. The creation timestamp of the view. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the view. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Filter that restricts which log entries in a bucket are visible in this - // view. - // - // Filters are restricted to be a logical AND of ==/!= of any of the - // following: - // - // - originating project/folder/organization/billing account. - // - resource type - // - log id - // - // For example: - // - // SOURCE("projects/myproject") AND resource.type = "gce_instance" - // AND LOG_ID("stdout") - string filter = 7; -} - -// Describes a sink used to export log entries to one of the following -// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a -// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log -// entries are exported. The sink must be created within a project, -// organization, billing account, or folder. -message LogSink { - option (google.api.resource) = { - type: "logging.googleapis.com/LogSink" - pattern: "projects/{project}/sinks/{sink}" - pattern: "organizations/{organization}/sinks/{sink}" - pattern: "folders/{folder}/sinks/{sink}" - pattern: "billingAccounts/{billing_account}/sinks/{sink}" - }; - - // Deprecated. This is unused. - enum VersionFormat { - // An unspecified format version that will default to V2. - VERSION_FORMAT_UNSPECIFIED = 0; - - // `LogEntry` version 2 format. - V2 = 1; - - // `LogEntry` version 1 format. - V1 = 2; - } - - // Required. The client-assigned sink identifier, unique within the project. - // - // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited - // to 100 characters and can include only the following characters: upper and - // lower-case alphanumeric characters, underscores, hyphens, and periods. - // First character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The export destination: - // - // "storage.googleapis.com/[GCS_BUCKET]" - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" - // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - // - // The sink's `writer_identity`, set when the sink is created, must have - // permission to write to the destination or else the log entries are not - // exported. For more information, see - // [Exporting Logs with - // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - string destination = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Optional. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The - // only exported log entries are those that are in the resource owning the - // sink and that match the filter. - // - // For example: - // - // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A description of this sink. - // - // The maximum length of the description is 8000 characters. - string description = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, then this sink is disabled and it does not export - // any log entries. - bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Log entries that match any of these exclusion filters will not be - // exported. - // - // If a log entry is matched by both `filter` and one of `exclusion_filters` - // it will not be exported. - repeated LogExclusion exclusions = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Deprecated. This field is unused. - VersionFormat output_version_format = 6 [deprecated = true]; - - // Output only. An IAM identity—a service account or group—under - // which Cloud Logging writes the exported log entries to the sink's - // destination. This field is either set by specifying - // `custom_writer_identity` or set automatically by - // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and - // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the - // value of `unique_writer_identity` in those methods. - // - // Until you grant this identity write-access to the destination, log entry - // exports from this sink will fail. For more information, see [Granting - // Access for a - // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). - // Consult the destination service's documentation to determine the - // appropriate IAM roles to assign to the identity. - // - // Sinks that have a destination that is a log bucket in the same project as - // the sink cannot have a writer_identity and no additional permissions are - // required. - string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This field applies only to sinks owned by organizations and - // folders. If the field is false, the default, only the logs owned by the - // sink's parent resource are available for export. If the field is true, then - // log entries from all the projects, folders, and billing accounts contained - // in the sink's parent resource are also available for export. Whether a - // particular log entry from the children is exported depends on the sink's - // filter expression. - // - // For example, if this field is true, then the filter - // `resource.type=gce_instance` would export all Compute Engine VM instance - // log entries from all projects in the sink's parent. - // - // To only export entries from certain child projects, filter on the project - // part of the log name: - // - // logName:("projects/test-project1/" OR "projects/test-project2/") AND - // resource.type=gce_instance - bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Destination dependent options. - oneof options { - // Optional. Options that affect sinks exporting data to BigQuery. - BigQueryOptions bigquery_options = 12 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The creation timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp create_time = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp update_time = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a BigQuery dataset that was created by a link. -message BigQueryDataset { - // Output only. The full resource name of the BigQuery dataset. The DATASET_ID - // will match the ID of the link, so the link must match the naming - // restrictions of BigQuery datasets (alphanumeric characters and underscores - // only). - // - // The dataset will have a resource path of - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]" - string dataset_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a link connected to an analytics enabled bucket. -message Link { - option (google.api.resource) = { - type: "logging.googleapis.com/Link" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}" - }; - - // The resource name of the link. The name can have up to 100 characters. - // A valid link id (at the end of the link name) must only have alphanumeric - // characters and underscores within it. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/links/my_link - string name = 1; - - // Describes this link. - // - // The maximum length of the description is 8000 characters. - string description = 2; - - // Output only. The creation timestamp of the link. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The resource lifecycle state. - LifecycleState lifecycle_state = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The information of a BigQuery Dataset. When a link is created, a BigQuery - // dataset is created along with it, in the same project as the LogBucket it's - // linked to. This dataset will also have BigQuery Views corresponding to the - // LogViews in the bucket. - BigQueryDataset bigquery_dataset = 5; -} - -// Options that change functionality of a sink exporting data to BigQuery. -message BigQueryOptions { - // Optional. Whether to use [BigQuery's partition - // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By - // default, Cloud Logging creates dated tables based on the log entries' - // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix - // is no longer present and [special query - // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) - // has to be used instead. In both cases, tables are sharded based on UTC - // timezone. - bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. True if new timestamp column based partitioning is in use, - // false if legacy ingestion-time partitioning is in use. - // - // All new sinks will have this field set true and will use timestamp column - // based partitioning. If use_partitioned_tables is false, this value has no - // meaning and will be false. Legacy sinks using partitioned tables will have - // this field set to false. - bool uses_timestamp_column_partitioning = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The parameters to `ListBuckets`. -message ListBucketsRequest { - // Required. The parent resource whose buckets are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - // - // Note: The locations portion of the resource must be specified, but - // supplying the character `-` in place of [LOCATION_ID] will return all - // buckets. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListBuckets. -message ListBucketsResponse { - // A list of buckets. - repeated LogBucket buckets = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateBucket`. -message CreateBucketRequest { - // Required. The resource in which to create the log bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // - // For example: - // - // `"projects/my-project/locations/global"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - // are limited to 100 characters and can include only letters, digits, - // underscores, hyphens, and periods. - string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new bucket. The region specified in the new bucket must be - // compliant with any Location Restriction Org Policy. The name field in the - // bucket is ignored. - LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateBucket`. -message UpdateBucketRequest { - // Required. The full resource name of the bucket to update. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. The updated bucket. - LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask that specifies the fields in `bucket` that need an - // update. A bucket field will be overwritten if, and only if, it is in the - // update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see: - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=retention_days` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `GetBucket`. -message GetBucketRequest { - // Required. The resource name of the bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `DeleteBucket`. -message DeleteBucketRequest { - // Required. The full resource name of the bucket to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `UndeleteBucket`. -message UndeleteBucketRequest { - // Required. The full resource name of the bucket to undelete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `ListViews`. -message ListViewsRequest { - // Required. The bucket whose views are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListViews. -message ListViewsResponse { - // A list of views. - repeated LogView views = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateView`. -message CreateViewRequest { - // Required. The bucket in which to create the view - // - // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client-assigned identifier such as `"my-view"`. Identifiers are - // limited to 100 characters and can include only letters, digits, - // underscores, hyphens, and periods. - string view_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new view. - LogView view = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateView`. -message UpdateViewRequest { - // Required. The full resource name of the view to update - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The updated view. - LogView view = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that specifies the fields in `view` that need - // an update. A field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `GetView`. -message GetViewRequest { - // Required. The resource name of the policy: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } - ]; -} - -// The parameters to `DeleteView`. -message DeleteViewRequest { - // Required. The full resource name of the view to delete: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } - ]; -} - -// The parameters to `ListSinks`. -message ListSinksRequest { - // Required. The parent resource whose sinks are to be listed: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListSinks`. -message ListSinksResponse { - // A list of sinks. - repeated LogSink sinks = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `GetSink`. -message GetSinkRequest { - // Required. The resource name of the sink: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; -} - -// The parameters to `CreateSink`. -message CreateSinkRequest { - // Required. The resource in which to create the sink: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - // - // For examples: - // - // `"projects/my-project"` - // `"organizations/123456789"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The new sink, whose `name` parameter is a sink identifier that - // is not already in use. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines the kind of IAM identity returned as `writer_identity` - // in the new sink. If this value is omitted or set to false, and if the - // sink's parent is a project, then the value returned as `writer_identity` is - // the same group or service account used by Cloud Logging before the addition - // of writer identities to this API. The sink's destination must be in the - // same project as the sink itself. - // - // If this field is set to true, or if the sink is owned by a non-project - // resource such as an organization, then the value of `writer_identity` will - // be a unique service account used only for exports from the new sink. For - // more information, see `writer_identity` in - // [LogSink][google.logging.v2.LogSink]. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `UpdateSink`. -message UpdateSinkRequest { - // Required. The full resource name of the sink to update, including the - // parent resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; - - // Required. The updated sink, whose name is the same identifier that appears - // as part of `sink_name`. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] - // for a description of this field. When updating a sink, the effect of this - // field on the value of `writer_identity` in the updated sink depends on both - // the old and new values of this field: - // - // + If the old and new values of this field are both false or both true, - // then there is no change to the sink's `writer_identity`. - // + If the old value is false and the new value is true, then - // `writer_identity` is changed to a unique service account. - // + It is an error if the old value is true and the new value is - // set to false or defaulted to false. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field mask that specifies the fields in `sink` that need - // an update. A sink field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // An empty `updateMask` is temporarily treated as using the following mask - // for backwards compatibility purposes: - // - // `destination,filter,includeChildren` - // - // At some point in the future, behavior will be removed and specifying an - // empty `updateMask` will be an error. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `DeleteSink`. -message DeleteSinkRequest { - // Required. The full resource name of the sink to delete, including the - // parent resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; -} - -// The parameters to CreateLink. -message CreateLinkRequest { - // Required. The full resource name of the bucket to create a link for. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Link" - } - ]; - - // Required. The new link. - Link link = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the link. The link_id can have up to 100 - // characters. A valid link_id must only have alphanumeric characters and - // underscores within it. - string link_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLink. -message DeleteLinkRequest { - // Required. The full resource name of the link to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } - ]; -} - -// The parameters to ListLinks. -message ListLinksRequest { - // Required. The parent resource whose links are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Link" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListLinks. -message ListLinksResponse { - // A list of links. - repeated Link links = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLink. -message GetLinkRequest { - // Required. The resource name of the link: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } - ]; -} - -// Specifies a set of log entries that are filtered out by a sink. If -// your Google Cloud resource receives a large volume of log entries, you can -// use exclusions to reduce your chargeable logs. Note that exclusions on -// organization-level and folder-level sinks don't apply to child resources. -// Note also that you cannot modify the _Required sink or exclude logs from it. -message LogExclusion { - option (google.api.resource) = { - type: "logging.googleapis.com/LogExclusion" - pattern: "projects/{project}/exclusions/{exclusion}" - pattern: "organizations/{organization}/exclusions/{exclusion}" - pattern: "folders/{folder}/exclusions/{exclusion}" - pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" - }; - - // Required. A client-assigned identifier, such as - // `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and - // can include only letters, digits, underscores, hyphens, and periods. First - // character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A description of this exclusion. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that - // matches the log entries to be excluded. By using the [sample - // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), - // you can exclude less than 100% of the matching log entries. - // - // For example, the following query matches 99% of low-severity log entries - // from Google Cloud Storage buckets: - // - // `resource.type=gcs_bucket severity=ERROR" - // - // The maximum length of the filter is 20000 characters. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The resource name of the Log Bucket that owns the Log Metric. - // Only Log Buckets in projects are supported. The bucket has to be in the - // same project as the metric. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // If empty, then the Log Metric is considered a non-Bucket Log Metric. - string bucket_name = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to True, then this metric is disabled and it does not - // generate any points. - bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The metric descriptor associated with the logs-based metric. - // If unspecified, it uses a default metric descriptor with a DELTA metric - // kind, INT64 value type, with no labels and a unit of "1". Such a metric - // counts the number of log entries matching the `filter` expression. - // - // The `name`, `type`, and `description` fields in the `metric_descriptor` - // are output only, and is constructed using the `name` and `description` - // field in the LogMetric. - // - // To create a logs-based metric that records a distribution of log values, a - // DELTA metric kind with a DISTRIBUTION value type must be used along with - // a `value_extractor` expression in the LogMetric. - // - // Each label in the metric descriptor must have a matching label - // name as the key and an extractor expression as the value in the - // `label_extractors` map. - // - // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot - // be updated once initially configured. New labels can be added in the - // `metric_descriptor`, but existing labels cannot be modified except for - // their description. - google.api.MetricDescriptor metric_descriptor = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A `value_extractor` is required when using a distribution - // logs-based metric to extract the values to record from a log entry. - // Two functions are supported for value extraction: `EXTRACT(field)` or - // `REGEXP_EXTRACT(field, regex)`. The arguments are: - // - // 1. field: The name of the log entry field from which the value is to be - // extracted. - // 2. regex: A regular expression using the Google RE2 syntax - // (https://github.com/google/re2/wiki/Syntax) with a single capture - // group to extract data from the specified log entry field. The value - // of the field is converted to a string before applying the regex. - // It is an error to specify a regex that does not include exactly one - // capture group. - // - // The result of the extraction must be convertible to a double type, as the - // distribution always records double values. If either the extraction or - // the conversion to double fails, then those values are not recorded in the - // distribution. - // - // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` - string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map from a label key string to an extractor expression which is - // used to extract data from a log entry field and assign as the label value. - // Each label key specified in the LabelDescriptor must have an associated - // extractor expression in this map. The syntax of the extractor expression - // is the same as for the `value_extractor` field. - // - // The extracted value is converted to the type defined in the label - // descriptor. If either the extraction or the type conversion fails, - // the label will have a default value. The default value for a string - // label is an empty string, for an integer label its 0, and for a boolean - // label its `false`. - // - // Note that there are upper bounds on the maximum number of labels and the - // number of active time series that are allowed in a project. - map label_extractors = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `bucket_options` are required when the logs-based metric is - // using a DISTRIBUTION value type and it describes the bucket boundaries - // used to create a histogram of the extracted values. - google.api.Distribution.BucketOptions bucket_options = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The creation timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp create_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp update_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Deprecated. The API version that created or updated this metric. - // The v2 format is used by default and cannot be changed. - ApiVersion version = 4 [deprecated = true]; -} - -// The parameters to ListLogMetrics. -message ListLogMetricsRequest { - // Required. The name of the project containing the metrics: - // - // "projects/[PROJECT_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogMetrics. -message ListLogMetricsResponse { - // A list of logs-based metrics. - repeated LogMetric metrics = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLogMetric. -message GetLogMetricRequest { - // Required. The resource name of the desired metric: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} - -// The parameters to CreateLogMetric. -message CreateLogMetricRequest { - // Required. The resource name of the project in which to create the metric: - // - // "projects/[PROJECT_ID]" - // - // The new metric must be provided in the request. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The new logs-based metric, which must not have an identifier that - // already exists. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to UpdateLogMetric. -message UpdateLogMetricRequest { - // Required. The resource name of the metric to update: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - // - // The updated metric must be provided in the request and it's - // `name` field must be the same as `[METRIC_ID]` If the metric - // does not exist in `[PROJECT_ID]`, then a new metric is created. - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The updated metric. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLogMetric. -message DeleteLogMetricRequest { - // Required. The resource name of the metric to delete: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} diff --git a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js deleted file mode 100644 index 23bfc32a..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, destination) { - // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Log bucket from which to copy log entries. - * For example: - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - */ - // const name = 'abc123' - /** - * Optional. A filter specifying which log entries to copy. The filter must be - * no more than 20k characters. An empty filter matches all log entries. - */ - // const filter = 'abc123' - /** - * Required. Destination to which to copy log entries. - */ - // const destination = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCopyLogEntries() { - // Construct request - const request = { - name, - destination, - }; - - // Run request - const [operation] = await loggingClient.copyLogEntries(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCopyLogEntries(); - // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_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/config_service_v2.create_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js deleted file mode 100644 index 1de575fc..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucket() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const response = await loggingClient.createBucket(request); - console.log(response); - } - - callCreateBucket(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucket_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/config_service_v2.create_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js deleted file mode 100644 index 864ee229..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucketAsync() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const [operation] = await loggingClient.createBucketAsync(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBucketAsync(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucketAsync_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/config_service_v2.create_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js deleted file mode 100644 index e2fa1898..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, exclusion) { - // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource in which to create the exclusion: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-logging-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - */ - // const exclusion = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateExclusion() { - // Construct request - const request = { - parent, - exclusion, - }; - - // Run request - const response = await loggingClient.createExclusion(request); - console.log(response); - } - - callCreateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_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/config_service_v2.create_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js deleted file mode 100644 index 56e3e2ad..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, link, linkId) { - // [START logging_v2_generated_ConfigServiceV2_CreateLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to create a link for. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Required. The new link. - */ - // const link = {} - /** - * Required. The ID to use for the link. The link_id can have up to 100 - * characters. A valid link_id must only have alphanumeric characters and - * underscores within it. - */ - // const linkId = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateLink() { - // Construct request - const request = { - parent, - link, - linkId, - }; - - // Run request - const [operation] = await loggingClient.createLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateLink(); - // [END logging_v2_generated_ConfigServiceV2_CreateLink_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/config_service_v2.create_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js deleted file mode 100644 index 46f64094..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, sink) { - // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the sink: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - */ - // const sink = {} - /** - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in - * LogSink google.logging.v2.LogSink. - */ - // const uniqueWriterIdentity = true - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateSink() { - // Construct request - const request = { - parent, - sink, - }; - - // Run request - const response = await loggingClient.createSink(request); - console.log(response); - } - - callCreateSink(); - // [END logging_v2_generated_ConfigServiceV2_CreateSink_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/config_service_v2.create_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js deleted file mode 100644 index 1d598493..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, viewId, view) { - // [START logging_v2_generated_ConfigServiceV2_CreateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket in which to create the view - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-view"`. Identifiers are - * limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const viewId = 'abc123' - /** - * Required. The new view. - */ - // const view = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateView() { - // Construct request - const request = { - parent, - viewId, - view, - }; - - // Run request - const response = await loggingClient.createView(request); - console.log(response); - } - - callCreateView(); - // [END logging_v2_generated_ConfigServiceV2_CreateView_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/config_service_v2.delete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js deleted file mode 100644 index 368c926b..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteBucket(request); - console.log(response); - } - - callDeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_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/config_service_v2.delete_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js deleted file mode 100644 index bf359314..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion to delete: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteExclusion(request); - console.log(response); - } - - callDeleteExclusion(); - // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_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/config_service_v2.delete_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js deleted file mode 100644 index 6a714386..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the link to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteLink() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await loggingClient.deleteLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteLink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteLink_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/config_service_v2.delete_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js deleted file mode 100644 index 0d90840d..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to delete, including the - * parent resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.deleteSink(request); - console.log(response); - } - - callDeleteSink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteSink_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/config_service_v2.delete_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js deleted file mode 100644 index 92ef8caf..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to delete: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteView(request); - console.log(response); - } - - callDeleteView(); - // [END logging_v2_generated_ConfigServiceV2_DeleteView_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/config_service_v2.get_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js deleted file mode 100644 index 0f9a7811..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getBucket(request); - console.log(response); - } - - callGetBucket(); - // [END logging_v2_generated_ConfigServiceV2_GetBucket_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/config_service_v2.get_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js deleted file mode 100644 index 1256b615..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve CMEK settings. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetCmekSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getCmekSettings(request); - console.log(response); - } - - callGetCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_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/config_service_v2.get_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js deleted file mode 100644 index a9459c99..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getExclusion(request); - console.log(response); - } - - callGetExclusion(); - // [END logging_v2_generated_ConfigServiceV2_GetExclusion_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/config_service_v2.get_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js deleted file mode 100644 index d95999ae..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the link: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetLink() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getLink(request); - console.log(response); - } - - callGetLink(); - // [END logging_v2_generated_ConfigServiceV2_GetLink_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/config_service_v2.get_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js deleted file mode 100644 index 99df9924..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve settings. - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetSettings_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/config_service_v2.get_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js deleted file mode 100644 index 21e331ee..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_GetSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the sink: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.getSink(request); - console.log(response); - } - - callGetSink(); - // [END logging_v2_generated_ConfigServiceV2_GetSink_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/config_service_v2.get_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js deleted file mode 100644 index d487ce10..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the policy: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getView(request); - console.log(response); - } - - callGetView(); - // [END logging_v2_generated_ConfigServiceV2_GetView_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/config_service_v2.list_buckets.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js deleted file mode 100644 index 48c9e415..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose buckets are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of LOCATION_ID will return all - * buckets. - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListBuckets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listBucketsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuckets(); - // [END logging_v2_generated_ConfigServiceV2_ListBuckets_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/config_service_v2.list_exclusions.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js deleted file mode 100644 index 888d53fd..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose exclusions are to be listed. - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListExclusions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listExclusionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExclusions(); - // [END logging_v2_generated_ConfigServiceV2_ListExclusions_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/config_service_v2.list_links.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js deleted file mode 100644 index fa5ac843..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListLinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose links are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListLinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLinks(); - // [END logging_v2_generated_ConfigServiceV2_ListLinks_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/config_service_v2.list_sinks.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js deleted file mode 100644 index 85486c8c..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose sinks are to be listed: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListSinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listSinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSinks(); - // [END logging_v2_generated_ConfigServiceV2_ListSinks_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/config_service_v2.list_views.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js deleted file mode 100644 index 815ee322..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListViews_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket whose views are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListViews() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listViewsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListViews(); - // [END logging_v2_generated_ConfigServiceV2_ListViews_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/config_service_v2.undelete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js deleted file mode 100644 index da866082..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to undelete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUndeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.undeleteBucket(request); - console.log(response); - } - - callUndeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_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/config_service_v2.update_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js deleted file mode 100644 index 9c98e2d3..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucket() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const response = await loggingClient.updateBucket(request); - console.log(response); - } - - callUpdateBucket(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_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/config_service_v2.update_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js deleted file mode 100644 index a06c31cc..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucketAsync() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const [operation] = await loggingClient.updateBucketAsync(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBucketAsync(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_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/config_service_v2.update_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js deleted file mode 100644 index 09012657..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, cmekSettings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the CMEK settings to update. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The CMEK settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const cmekSettings = {} - /** - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateCmekSettings() { - // Construct request - const request = { - name, - cmekSettings, - }; - - // Run request - const response = await loggingClient.updateCmekSettings(request); - console.log(response); - } - - callUpdateCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_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/config_service_v2.update_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js deleted file mode 100644 index 11cc66d5..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, exclusion, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the exclusion to update: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - /** - * Required. New values for the existing exclusion. Only the fields specified - * in `update_mask` are relevant. - */ - // const exclusion = {} - /** - * Required. A non-empty list of fields to change in the existing exclusion. - * New values for the fields are taken from the corresponding fields in the - * LogExclusion google.logging.v2.LogExclusion included in this request. - * Fields not mentioned in `update_mask` are not changed and are ignored in - * the request. - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateExclusion() { - // Construct request - const request = { - name, - exclusion, - updateMask, - }; - - // Run request - const response = await loggingClient.updateExclusion(request); - console.log(response); - } - - callUpdateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_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/config_service_v2.update_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js deleted file mode 100644 index 35ebd66f..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, settings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the settings to update. - * "organizations/[ORGANIZATION_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const settings = {} - /** - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSettings() { - // Construct request - const request = { - name, - settings, - }; - - // Run request - const response = await loggingClient.updateSettings(request); - console.log(response); - } - - callUpdateSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_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/config_service_v2.update_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js deleted file mode 100644 index 7fd08496..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName, sink) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to update, including the - * parent resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - /** - * Required. The updated sink, whose name is the same identifier that appears - * as part of `sink_name`. - */ - // const sink = {} - /** - * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - */ - // const uniqueWriterIdentity = true - /** - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * `destination,filter,includeChildren` - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSink() { - // Construct request - const request = { - sinkName, - sink, - }; - - // Run request - const response = await loggingClient.updateSink(request); - console.log(response); - } - - callUpdateSink(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSink_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/config_service_v2.update_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js deleted file mode 100644 index acc6bfb9..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, view) { - // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to update - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - /** - * Required. The updated view. - */ - // const view = {} - /** - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateView() { - // Construct request - const request = { - name, - view, - }; - - // Run request - const response = await loggingClient.updateView(request); - console.log(response); - } - - callUpdateView(); - // [END logging_v2_generated_ConfigServiceV2_UpdateView_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/logging_service_v2.delete_log.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js deleted file mode 100644 index c8b817e7..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(logName) { - // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the log to delete: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * For more information about log names, see - * LogEntry google.logging.v2.LogEntry. - */ - // const logName = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callDeleteLog() { - // Construct request - const request = { - logName, - }; - - // Run request - const response = await loggingClient.deleteLog(request); - console.log(response); - } - - callDeleteLog(); - // [END logging_v2_generated_LoggingServiceV2_DeleteLog_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/logging_service_v2.list_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js deleted file mode 100644 index 355fcc84..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - */ - // const filter = 'abc123' - /** - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - */ - // const orderBy = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const iterable = await loggingClient.listLogEntriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_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/logging_service_v2.list_logs.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js deleted file mode 100644 index 1e8c7caa..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name to list logs for: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const parent = 'abc123' - /** - * Optional. List of resource names to list logs for: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * To support legacy queries, it could also be: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * The resource name in the `parent` field is added to this list. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogs(); - // [END logging_v2_generated_LoggingServiceV2_ListLogs_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/logging_service_v2.list_monitored_resource_descriptors.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js deleted file mode 100644 index 4552dacd..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - }; - - // Run request - const iterable = await loggingClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_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/logging_service_v2.tail_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js deleted file mode 100644 index a0d3eeb7..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of a parent resource from which to retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - */ - // const resourceNames = ['abc','def'] - /** - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - */ - // const filter = 'abc123' - /** - * Optional. The amount of time to buffer log entries at the server before - * being returned to prevent out of order results due to late arriving log - * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - * milliseconds. - */ - // const bufferWindow = {} - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callTailLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const stream = await loggingClient.tailLogEntries(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callTailLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_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/logging_service_v2.write_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js deleted file mode 100644 index 888245ae..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(entries) { - // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example: - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - */ - // const logName = 'abc123' - /** - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * See LogEntry google.logging.v2.LogEntry. - */ - // const resource = {} - /** - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See LogEntry google.logging.v2.LogEntry. - */ - // const labels = [1,2,3,4] - /** - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * LogEntry google.logging.v2.LogEntry type. - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * Log entries with timestamps that are more than the - * logs retention period (https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be exported - * with - * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * To improve throughput and to avoid exceeding the - * quota limit (https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - */ - // const entries = [1,2,3,4] - /** - * Optional. Whether a batch's valid entries should be written even if some - * other entry failed due to a permanent error such as INVALID_ARGUMENT or - * PERMISSION_DENIED. If any entry failed, then the response status is the - * response status of one of the failed entries. The response will include - * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - * the entries' zero-based index in the `entries`. Failed requests for which - * no entries are written will not include per-entry errors. - */ - // const partialSuccess = true - /** - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - */ - // const dryRun = true - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callWriteLogEntries() { - // Construct request - const request = { - entries, - }; - - // Run request - const response = await loggingClient.writeLogEntries(request); - console.log(response); - } - - callWriteLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_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/metrics_service_v2.create_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js deleted file mode 100644 index b48ae935..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, metric) { - // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project in which to create the metric: - * "projects/[PROJECT_ID]" - * The new metric must be provided in the request. - */ - // const parent = 'abc123' - /** - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callCreateLogMetric() { - // Construct request - const request = { - parent, - metric, - }; - - // Run request - const response = await loggingClient.createLogMetric(request); - console.log(response); - } - - callCreateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_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/metrics_service_v2.delete_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js deleted file mode 100644 index 661e224f..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to delete: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callDeleteLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.deleteLogMetric(request); - console.log(response); - } - - callDeleteLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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/metrics_service_v2.get_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js deleted file mode 100644 index c8d8b6a0..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the desired metric: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callGetLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.getLogMetric(request); - console.log(response); - } - - callGetLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_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/metrics_service_v2.list_log_metrics.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js deleted file mode 100644 index 558322ef..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project containing the metrics: - * "projects/[PROJECT_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callListLogMetrics() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLogMetricsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogMetrics(); - // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_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/metrics_service_v2.update_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js deleted file mode 100644 index 942d8246..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName, metric) { - // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to update: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - */ - // const metricName = 'abc123' - /** - * Required. The updated metric. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callUpdateLogMetric() { - // Construct request - const request = { - metricName, - metric, - }; - - // Run request - const response = await loggingClient.updateLogMetric(request); - console.log(response); - } - - callUpdateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_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.logging.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json deleted file mode 100644 index c6798780..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json +++ /dev/null @@ -1,1963 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-logging", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.logging.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", - "title": "logging listBuckets Sample", - "origin": "API_DEFINITION", - "description": " Lists log buckets.", - "canonical": true, - "file": "config_service_v2.list_buckets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListBucketsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", - "title": "logging getBucket Sample", - "origin": "API_DEFINITION", - "description": " Gets a log bucket.", - "canonical": true, - "file": "config_service_v2.get_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async", - "title": "logging createBucketAsync Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket asynchronously that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async", - "title": "logging updateBucketAsync Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket asynchronously. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", - "title": "logging createBucket Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", - "title": "logging updateBucket Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", - "title": "logging deleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", - "canonical": true, - "file": "config_service_v2.delete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", - "title": "logging undeleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", - "canonical": true, - "file": "config_service_v2.undelete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", - "title": "logging listViews Sample", - "origin": "API_DEFINITION", - "description": " Lists views on a log bucket.", - "canonical": true, - "file": "config_service_v2.list_views.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListViewsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", - "title": "logging getView Sample", - "origin": "API_DEFINITION", - "description": " Gets a view on a log bucket..", - "canonical": true, - "file": "config_service_v2.get_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", - "title": "logging createView Sample", - "origin": "API_DEFINITION", - "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", - "canonical": true, - "file": "config_service_v2.create_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", - "title": "logging updateView Sample", - "origin": "API_DEFINITION", - "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.update_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", - "title": "logging deleteView Sample", - "origin": "API_DEFINITION", - "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.delete_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", - "title": "logging listSinks Sample", - "origin": "API_DEFINITION", - "description": " Lists sinks.", - "canonical": true, - "file": "config_service_v2.list_sinks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListSinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", - "title": "logging getSink Sample", - "origin": "API_DEFINITION", - "description": " Gets a sink.", - "canonical": true, - "file": "config_service_v2.get_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", - "title": "logging createSink Sample", - "origin": "API_DEFINITION", - "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", - "canonical": true, - "file": "config_service_v2.create_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", - "title": "logging updateSink Sample", - "origin": "API_DEFINITION", - "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", - "canonical": true, - "file": "config_service_v2.update_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", - "title": "logging deleteSink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", - "canonical": true, - "file": "config_service_v2.delete_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateLink_async", - "title": "logging createLink Sample", - "origin": "API_DEFINITION", - "description": " Asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.", - "canonical": true, - "file": "config_service_v2.create_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "link", - "type": ".google.logging.v2.Link" - }, - { - "name": "link_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateLink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteLink_async", - "title": "logging deleteLink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a link. This will also delete the corresponding BigQuery linked dataset.", - "canonical": true, - "file": "config_service_v2.delete_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteLink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListLinks_async", - "title": "logging listLinks Sample", - "origin": "API_DEFINITION", - "description": " Lists links.", - "canonical": true, - "file": "config_service_v2.list_links.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListLinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetLink_async", - "title": "logging getLink Sample", - "origin": "API_DEFINITION", - "description": " Gets a link.", - "canonical": true, - "file": "config_service_v2.get_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLink", - "fullName": "google.logging.v2.ConfigServiceV2.GetLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Link", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetLink", - "fullName": "google.logging.v2.ConfigServiceV2.GetLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", - "title": "logging listExclusions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the exclusions on the _Default sink in a parent resource.", - "canonical": true, - "file": "config_service_v2.list_exclusions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListExclusionsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", - "title": "logging getExclusion Sample", - "origin": "API_DEFINITION", - "description": " Gets the description of an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.get_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", - "title": "logging createExclusion Sample", - "origin": "API_DEFINITION", - "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", - "canonical": true, - "file": "config_service_v2.create_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", - "title": "logging updateExclusion Sample", - "origin": "API_DEFINITION", - "description": " Changes one or more properties of an existing exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.update_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", - "title": "logging deleteExclusion Sample", - "origin": "API_DEFINITION", - "description": " Deletes an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.delete_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", - "title": "logging getCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", - "title": "logging updateCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "cmek_settings", - "type": ".google.logging.v2.CmekSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", - "title": "logging getSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", - "title": "logging updateSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "settings", - "type": ".google.logging.v2.Settings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", - "title": "logging copyLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", - "canonical": true, - "file": "config_service_v2.copy_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "destination", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", - "title": "logging deleteLog Sample", - "origin": "API_DEFINITION", - "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", - "canonical": true, - "file": "logging_service_v2.delete_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", - "title": "logging writeLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", - "canonical": true, - "file": "logging_service_v2.write_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 121, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.api.MonitoredResource" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "entries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "partial_success", - "type": "TYPE_BOOL" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.WriteLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", - "title": "logging listLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", - "canonical": true, - "file": "logging_service_v2.list_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 98, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", - "title": "logging listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for monitored resource types used by Logging.", - "canonical": true, - "file": "logging_service_v2.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", - "title": "logging listLogs Sample", - "origin": "API_DEFINITION", - "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", - "canonical": true, - "file": "logging_service_v2.list_logs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", - "title": "logging tailLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", - "canonical": true, - "file": "logging_service_v2.tail_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "buffer_window", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.logging.v2.TailLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", - "title": "logging listLogMetrics Sample", - "origin": "API_DEFINITION", - "description": " Lists logs-based metrics.", - "canonical": true, - "file": "metrics_service_v2.list_log_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLogMetricsResponse", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", - "title": "logging getLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Gets a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.get_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", - "title": "logging createLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.create_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", - "title": "logging updateLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.update_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", - "title": "logging deleteLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Deletes a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.delete_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index ca1a43eb..00000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const ConfigServiceV2Client = v2.ConfigServiceV2Client; -type ConfigServiceV2Client = v2.ConfigServiceV2Client; -const LoggingServiceV2Client = v2.LoggingServiceV2Client; -type LoggingServiceV2Client = v2.LoggingServiceV2Client; -const MetricsServiceV2Client = v2.MetricsServiceV2Client; -type MetricsServiceV2Client = v2.MetricsServiceV2Client; -export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts deleted file mode 100644 index f749a38b..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts +++ /dev/null @@ -1,5530 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/config_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './config_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring sinks used to route log entries. - * @class - * @memberof v2 - */ -export class ConfigServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - configServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConfigServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConfigServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConfigServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listBuckets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), - listViews: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), - listSinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), - listLinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'links'), - listExclusions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=*/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=folders/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=*/*/locations/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=organizations/*/locations/*/operations/*}',},{get: '/v2/{name=folders/*/locations/*/operations/*}',},{get: '/v2/{name=billingAccounts/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=*/*/locations/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=organizations/*/locations/*}/operations',},{get: '/v2/{name=folders/*/locations/*}/operations',},{get: '/v2/{name=billingAccounts/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createBucketAsyncResponse = protoFilesRoot.lookup( - '.google.logging.v2.LogBucket') as gax.protobuf.Type; - const createBucketAsyncMetadata = protoFilesRoot.lookup( - '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; - const updateBucketAsyncResponse = protoFilesRoot.lookup( - '.google.logging.v2.LogBucket') as gax.protobuf.Type; - const updateBucketAsyncMetadata = protoFilesRoot.lookup( - '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; - const createLinkResponse = protoFilesRoot.lookup( - '.google.logging.v2.Link') as gax.protobuf.Type; - const createLinkMetadata = protoFilesRoot.lookup( - '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; - const deleteLinkResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteLinkMetadata = protoFilesRoot.lookup( - '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; - const copyLogEntriesResponse = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; - const copyLogEntriesMetadata = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBucketAsync: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBucketAsyncResponse.decode.bind(createBucketAsyncResponse), - createBucketAsyncMetadata.decode.bind(createBucketAsyncMetadata)), - updateBucketAsync: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBucketAsyncResponse.decode.bind(updateBucketAsyncResponse), - updateBucketAsyncMetadata.decode.bind(updateBucketAsyncMetadata)), - createLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createLinkResponse.decode.bind(createLinkResponse), - createLinkMetadata.decode.bind(createLinkMetadata)), - deleteLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteLinkResponse.decode.bind(deleteLinkResponse), - deleteLinkMetadata.decode.bind(deleteLinkMetadata)), - copyLogEntries: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), - copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.configServiceV2Stub) { - return this.configServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.ConfigServiceV2. - this.configServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.ConfigServiceV2, - 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 configServiceV2StubMethods = - ['listBuckets', 'getBucket', 'createBucketAsync', 'updateBucketAsync', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'createLink', 'deleteLink', 'listLinks', 'getLink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; - for (const methodName of configServiceV2StubMethods) { - const callPromise = this.configServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.configServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read' - ]; - } - - 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 -- - // ------------------- -/** - * Gets a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async - */ - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBucket(request, options, callback); - } -/** - * Creates a log bucket that can be used to store log entries. After a bucket - * has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async - */ - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBucket(request, options, callback); - } -/** - * Updates a log bucket. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async - */ - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBucket(request, options, callback); - } -/** - * Deletes a log bucket. - * - * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - * After 7 days, the bucket will be purged and all log entries in the bucket - * will be permanently deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async - */ - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBucket(request, options, callback); - } -/** - * Undeletes a log bucket. A bucket that has been deleted can be undeleted - * within the grace period of 7 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to undelete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async - */ - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.undeleteBucket(request, options, callback); - } -/** - * Gets a view on a log bucket.. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async - */ - getView( - request?: protos.google.logging.v2.IGetViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>; - getView( - request: protos.google.logging.v2.IGetViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request: protos.google.logging.v2.IGetViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request?: protos.google.logging.v2.IGetViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getView(request, options, callback); - } -/** - * Creates a view over log entries in a log bucket. A bucket may contain a - * maximum of 30 views. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket in which to create the view - * - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {string} request.viewId - * Required. A client-assigned identifier such as `"my-view"`. Identifiers are - * limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogView} request.view - * Required. The new view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async - */ - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createView(request, options, callback); - } -/** - * Updates a view on a log bucket. This method replaces the following fields - * in the existing view with values from the new view: `filter`. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can update the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to update - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {google.logging.v2.LogView} request.view - * Required. The updated view. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async - */ - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateView(request, options, callback); - } -/** - * Deletes a view on a log bucket. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can delete the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to delete: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async - */ - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteView(request, options, callback); - } -/** - * Gets a sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The resource name of the sink: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async - */ - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSink(request, options, callback); - } -/** - * Creates a sink that exports specified log entries to a destination. The - * export of newly-ingested log entries begins immediately, unless the sink's - * `writer_identity` is not permitted to write to the destination. A sink can - * export log entries only from the resource owning the sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the sink: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in - * {@link protos.google.logging.v2.LogSink|LogSink}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async - */ - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSink(request, options, callback); - } -/** - * Updates a sink. This method replaces the following fields in the existing - * sink with values from the new sink: `destination`, and `filter`. - * - * The updated sink might also have a new `writer_identity`; see the - * `unique_writer_identity` field. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to update, including the - * parent resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The updated sink, whose name is the same identifier that appears - * as part of `sink_name`. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * - * `destination,filter,includeChildren` - * - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async - */ - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSink(request, options, callback); - } -/** - * Deletes a sink. If the sink has a unique `writer_identity`, then that - * service account is also deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to delete, including the - * parent resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async - */ - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSink(request, options, callback); - } -/** - * Gets a link. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the link: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Link|Link}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetLink_async - */ - getLink( - request?: protos.google.logging.v2.IGetLinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined - ]>; - getLink( - request: protos.google.logging.v2.IGetLinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): void; - getLink( - request: protos.google.logging.v2.IGetLinkRequest, - callback: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): void; - getLink( - request?: protos.google.logging.v2.IGetLinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLink(request, options, callback); - } -/** - * Gets the description of an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async - */ - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExclusion(request, options, callback); - } -/** - * Creates a new exclusion in the _Default sink in a specified parent - * resource. Only log entries belonging to that resource can be excluded. You - * can have up to 10 exclusions in a resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource in which to create the exclusion: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-logging-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async - */ - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExclusion(request, options, callback); - } -/** - * Changes one or more properties of an existing exclusion in the _Default - * sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the exclusion to update: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. New values for the existing exclusion. Only the fields specified - * in `update_mask` are relevant. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A non-empty list of fields to change in the existing exclusion. - * New values for the fields are taken from the corresponding fields in the - * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. - * Fields not mentioned in `update_mask` are not changed and are ignored in - * the request. - * - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async - */ - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateExclusion(request, options, callback); - } -/** - * Deletes an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion to delete: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async - */ - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteExclusion(request, options, callback); - } -/** - * Gets the Logging CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve CMEK settings. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async - */ - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCmekSettings(request, options, callback); - } -/** - * Updates the Log Router CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the CMEK settings to update. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.CmekSettings} request.cmekSettings - * Required. The CMEK settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async - */ - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCmekSettings(request, options, callback); - } -/** - * Gets the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve settings. - * - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async - */ - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSettings(request, options, callback); - } -/** - * Updates the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. 4) `location_id` is not supported by - * Logging. 5) `location_id` violate OrgPolicy. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the settings to update. - * - * "organizations/[ORGANIZATION_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.Settings} request.settings - * Required. The settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async - */ - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSettings(request, options, callback); - } - -/** - * Creates a log bucket asynchronously that can be used to store log entries. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async - */ - createBucketAsync( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBucketAsync( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBucketAsync(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBucketAsync()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async - */ - async checkCreateBucketAsyncProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBucketAsync, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a log bucket asynchronously. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async - */ - updateBucketAsync( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBucketAsync( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBucketAsync(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBucketAsync()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async - */ - async checkUpdateBucketAsyncProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBucketAsync, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Asynchronously creates a linked dataset in BigQuery which makes it possible - * to use BigQuery to read the logs stored in the log bucket. A log bucket may - * currently only contain one link. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The full resource name of the bucket to create a link for. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {google.logging.v2.Link} request.link - * Required. The new link. - * @param {string} request.linkId - * Required. The ID to use for the link. The link_id can have up to 100 - * characters. A valid link_id must only have alphanumeric characters and - * underscores within it. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async - */ - createLink( - request?: protos.google.logging.v2.ICreateLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createLink( - request?: protos.google.logging.v2.ICreateLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createLink(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async - */ - async checkCreateLinkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a link. This will also delete the corresponding BigQuery linked - * dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the link to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async - */ - deleteLink( - request?: protos.google.logging.v2.IDeleteLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteLink( - request?: protos.google.logging.v2.IDeleteLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLink(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async - */ - async checkDeleteLinkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Copies a set of log entries from a log bucket to a Cloud Storage bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Log bucket from which to copy log entries. - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - * @param {string} [request.filter] - * Optional. A filter specifying which log entries to copy. The filter must be - * no more than 20k characters. An empty filter matches all log entries. - * @param {string} request.destination - * Required. Destination to which to copy log entries. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|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 || {}; - this.initialize(); - return this.innerApiCalls.copyLogEntries(request, options, callback); - } -/** - * Check the status of the long running operation returned by `copyLogEntries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - async checkCopyLogEntriesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists log buckets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>, - callback?: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBuckets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogBucket|LogBucket} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBucketsStream( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuckets.createStream( - this.innerApiCalls.listBuckets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuckets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogBucket|LogBucket}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_buckets.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async - */ - listBucketsAsync( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuckets.asyncIterate( - this.innerApiCalls['listBuckets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists views on a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogView|LogView}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>, - callback?: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listViews(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogView|LogView} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listViewsStream( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listViews.createStream( - this.innerApiCalls.listViews as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listViews`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogView|LogView}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_views.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async - */ - listViewsAsync( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listViews.asyncIterate( - this.innerApiCalls['listViews'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists sinks. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogSink|LogSink}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSinks(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogSink|LogSink} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSinksStream( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSinks.createStream( - this.innerApiCalls.listSinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSinks`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogSink|LogSink}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_sinks.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async - */ - listSinksAsync( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSinks.asyncIterate( - this.innerApiCalls['listSinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists links. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.Link|Link}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLinks( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILink[], - protos.google.logging.v2.IListLinksRequest|null, - protos.google.logging.v2.IListLinksResponse - ]>; - listLinks( - request: protos.google.logging.v2.IListLinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): void; - listLinks( - request: protos.google.logging.v2.IListLinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): void; - listLinks( - request?: protos.google.logging.v2.IListLinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): - Promise<[ - protos.google.logging.v2.ILink[], - protos.google.logging.v2.IListLinksRequest|null, - protos.google.logging.v2.IListLinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLinks(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.Link|Link} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLinksStream( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLinks.createStream( - this.innerApiCalls.listLinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLinks`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.Link|Link}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_links.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListLinks_async - */ - listLinksAsync( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLinks.asyncIterate( - this.innerApiCalls['listLinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the exclusions on the _Default sink in a parent resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>, - callback?: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExclusions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExclusionsStream( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExclusions.createStream( - this.innerApiCalls.listExclusions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExclusions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogExclusion|LogExclusion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_exclusions.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async - */ - listExclusionsAsync( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExclusions.asyncIterate( - this.innerApiCalls['listExclusions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.configServiceV2Stub && !this._terminated) { - return this.configServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json deleted file mode 100644 index 0e890aa4..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.ConfigServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "ListBuckets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucketAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucketAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListViews": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSinks": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateSink": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLinks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListExclusions": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CopyLogEntries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] 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 047d5888..00000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,512 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.logging.v2", - "libraryPackage": "@google-cloud/logging", - "services": { - "ConfigServiceV2": { - "clients": { - "grpc": { - "libraryClient": "ConfigServiceV2Client", - "rpcs": { - "GetBucket": { - "methods": [ - "getBucket" - ] - }, - "CreateBucket": { - "methods": [ - "createBucket" - ] - }, - "UpdateBucket": { - "methods": [ - "updateBucket" - ] - }, - "DeleteBucket": { - "methods": [ - "deleteBucket" - ] - }, - "UndeleteBucket": { - "methods": [ - "undeleteBucket" - ] - }, - "GetView": { - "methods": [ - "getView" - ] - }, - "CreateView": { - "methods": [ - "createView" - ] - }, - "UpdateView": { - "methods": [ - "updateView" - ] - }, - "DeleteView": { - "methods": [ - "deleteView" - ] - }, - "GetSink": { - "methods": [ - "getSink" - ] - }, - "CreateSink": { - "methods": [ - "createSink" - ] - }, - "UpdateSink": { - "methods": [ - "updateSink" - ] - }, - "DeleteSink": { - "methods": [ - "deleteSink" - ] - }, - "GetLink": { - "methods": [ - "getLink" - ] - }, - "GetExclusion": { - "methods": [ - "getExclusion" - ] - }, - "CreateExclusion": { - "methods": [ - "createExclusion" - ] - }, - "UpdateExclusion": { - "methods": [ - "updateExclusion" - ] - }, - "DeleteExclusion": { - "methods": [ - "deleteExclusion" - ] - }, - "GetCmekSettings": { - "methods": [ - "getCmekSettings" - ] - }, - "UpdateCmekSettings": { - "methods": [ - "updateCmekSettings" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateBucketAsync": { - "methods": [ - "createBucketAsync" - ] - }, - "UpdateBucketAsync": { - "methods": [ - "updateBucketAsync" - ] - }, - "CreateLink": { - "methods": [ - "createLink" - ] - }, - "DeleteLink": { - "methods": [ - "deleteLink" - ] - }, - "CopyLogEntries": { - "methods": [ - "copyLogEntries" - ] - }, - "ListBuckets": { - "methods": [ - "listBuckets", - "listBucketsStream", - "listBucketsAsync" - ] - }, - "ListViews": { - "methods": [ - "listViews", - "listViewsStream", - "listViewsAsync" - ] - }, - "ListSinks": { - "methods": [ - "listSinks", - "listSinksStream", - "listSinksAsync" - ] - }, - "ListLinks": { - "methods": [ - "listLinks", - "listLinksStream", - "listLinksAsync" - ] - }, - "ListExclusions": { - "methods": [ - "listExclusions", - "listExclusionsStream", - "listExclusionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConfigServiceV2Client", - "rpcs": { - "GetBucket": { - "methods": [ - "getBucket" - ] - }, - "CreateBucket": { - "methods": [ - "createBucket" - ] - }, - "UpdateBucket": { - "methods": [ - "updateBucket" - ] - }, - "DeleteBucket": { - "methods": [ - "deleteBucket" - ] - }, - "UndeleteBucket": { - "methods": [ - "undeleteBucket" - ] - }, - "GetView": { - "methods": [ - "getView" - ] - }, - "CreateView": { - "methods": [ - "createView" - ] - }, - "UpdateView": { - "methods": [ - "updateView" - ] - }, - "DeleteView": { - "methods": [ - "deleteView" - ] - }, - "GetSink": { - "methods": [ - "getSink" - ] - }, - "CreateSink": { - "methods": [ - "createSink" - ] - }, - "UpdateSink": { - "methods": [ - "updateSink" - ] - }, - "DeleteSink": { - "methods": [ - "deleteSink" - ] - }, - "GetLink": { - "methods": [ - "getLink" - ] - }, - "GetExclusion": { - "methods": [ - "getExclusion" - ] - }, - "CreateExclusion": { - "methods": [ - "createExclusion" - ] - }, - "UpdateExclusion": { - "methods": [ - "updateExclusion" - ] - }, - "DeleteExclusion": { - "methods": [ - "deleteExclusion" - ] - }, - "GetCmekSettings": { - "methods": [ - "getCmekSettings" - ] - }, - "UpdateCmekSettings": { - "methods": [ - "updateCmekSettings" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateBucketAsync": { - "methods": [ - "createBucketAsync" - ] - }, - "UpdateBucketAsync": { - "methods": [ - "updateBucketAsync" - ] - }, - "CreateLink": { - "methods": [ - "createLink" - ] - }, - "DeleteLink": { - "methods": [ - "deleteLink" - ] - }, - "CopyLogEntries": { - "methods": [ - "copyLogEntries" - ] - }, - "ListBuckets": { - "methods": [ - "listBuckets", - "listBucketsStream", - "listBucketsAsync" - ] - }, - "ListViews": { - "methods": [ - "listViews", - "listViewsStream", - "listViewsAsync" - ] - }, - "ListSinks": { - "methods": [ - "listSinks", - "listSinksStream", - "listSinksAsync" - ] - }, - "ListLinks": { - "methods": [ - "listLinks", - "listLinksStream", - "listLinksAsync" - ] - }, - "ListExclusions": { - "methods": [ - "listExclusions", - "listExclusionsStream", - "listExclusionsAsync" - ] - } - } - } - } - }, - "LoggingServiceV2": { - "clients": { - "grpc": { - "libraryClient": "LoggingServiceV2Client", - "rpcs": { - "DeleteLog": { - "methods": [ - "deleteLog" - ] - }, - "WriteLogEntries": { - "methods": [ - "writeLogEntries" - ] - }, - "TailLogEntries": { - "methods": [ - "tailLogEntries" - ] - }, - "ListLogEntries": { - "methods": [ - "listLogEntries", - "listLogEntriesStream", - "listLogEntriesAsync" - ] - }, - "ListMonitoredResourceDescriptors": { - "methods": [ - "listMonitoredResourceDescriptors", - "listMonitoredResourceDescriptorsStream", - "listMonitoredResourceDescriptorsAsync" - ] - }, - "ListLogs": { - "methods": [ - "listLogs", - "listLogsStream", - "listLogsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "LoggingServiceV2Client", - "rpcs": { - "DeleteLog": { - "methods": [ - "deleteLog" - ] - }, - "WriteLogEntries": { - "methods": [ - "writeLogEntries" - ] - }, - "ListLogEntries": { - "methods": [ - "listLogEntries", - "listLogEntriesStream", - "listLogEntriesAsync" - ] - }, - "ListMonitoredResourceDescriptors": { - "methods": [ - "listMonitoredResourceDescriptors", - "listMonitoredResourceDescriptorsStream", - "listMonitoredResourceDescriptorsAsync" - ] - }, - "ListLogs": { - "methods": [ - "listLogs", - "listLogsStream", - "listLogsAsync" - ] - } - } - } - } - }, - "MetricsServiceV2": { - "clients": { - "grpc": { - "libraryClient": "MetricsServiceV2Client", - "rpcs": { - "GetLogMetric": { - "methods": [ - "getLogMetric" - ] - }, - "CreateLogMetric": { - "methods": [ - "createLogMetric" - ] - }, - "UpdateLogMetric": { - "methods": [ - "updateLogMetric" - ] - }, - "DeleteLogMetric": { - "methods": [ - "deleteLogMetric" - ] - }, - "ListLogMetrics": { - "methods": [ - "listLogMetrics", - "listLogMetricsStream", - "listLogMetricsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MetricsServiceV2Client", - "rpcs": { - "GetLogMetric": { - "methods": [ - "getLogMetric" - ] - }, - "CreateLogMetric": { - "methods": [ - "createLogMetric" - ] - }, - "UpdateLogMetric": { - "methods": [ - "updateLogMetric" - ] - }, - "DeleteLogMetric": { - "methods": [ - "deleteLogMetric" - ] - }, - "ListLogMetrics": { - "methods": [ - "listLogMetrics", - "listLogMetricsStream", - "listLogMetricsAsync" - ] - } - } - } - } - } - } -} 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 75a03763..00000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {ConfigServiceV2Client} from './config_service_v2_client'; -export {LoggingServiceV2Client} from './logging_service_v2_client'; -export {MetricsServiceV2Client} from './metrics_service_v2_client'; diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts deleted file mode 100644 index cdf06265..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts +++ /dev/null @@ -1,2754 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/logging_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './logging_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for ingesting and querying logs. - * @class - * @memberof v2 - */ -export class LoggingServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - loggingServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LoggingServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new LoggingServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LoggingServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listLogEntries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listLogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // Some methods on this API support automatically batching - // requests; denote this. - - this.descriptors.batching = { - writeLogEntries: new this._gaxModule.BundleDescriptor( - 'entries', - ['log_name','resource','labels'], - null, - this._gaxModule.GrpcClient.createByteLengthFunction( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.loggingServiceV2Stub) { - return this.loggingServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.LoggingServiceV2. - this.loggingServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.LoggingServiceV2, - 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 loggingServiceV2StubMethods = - ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; - for (const methodName of loggingServiceV2StubMethods) { - const callPromise = this.loggingServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.batching?.[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.loggingServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - 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 -- - // ------------------- -/** - * Deletes all the log entries in a log for the _Default Log Bucket. The log - * reappears if it receives new entries. Log entries written shortly before - * the delete operation might not be deleted. Entries received after the - * delete operation with a timestamp before the operation will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.logName - * Required. The resource name of the log to delete: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * - * For more information about log names, see - * {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.delete_log.js - * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async - */ - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'log_name': request.logName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLog(request, options, callback); - } -/** - * Writes log entries to Logging. This API method is the - * only way to send log entries to Logging. This method - * is used, directly or indirectly, by the Logging agent - * (fluentd) and all logging libraries configured to use Logging. - * A single request may contain log entries for a maximum of 1000 - * different resources (projects, organizations, billing accounts or - * folders) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.logName] - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example: - * - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - * @param {google.api.MonitoredResource} [request.resource] - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} [request.labels] - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} request.entries - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * {@link protos.google.logging.v2.LogEntry|LogEntry} type. - * - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * - * Log entries with timestamps that are more than the - * [logs retention period](https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be [exported - * with - * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * - * To improve throughput and to avoid exceeding the - * [quota limit](https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - * @param {boolean} [request.partialSuccess] - * Optional. Whether a batch's valid entries should be written even if some - * other entry failed due to a permanent error such as INVALID_ARGUMENT or - * PERMISSION_DENIED. If any entry failed, then the response status is the - * response status of one of the failed entries. The response will include - * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - * the entries' zero-based index in the `entries`. Failed requests for which - * no entries are written will not include per-entry errors. - * @param {boolean} [request.dryRun] - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async - */ - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.writeLogEntries(request, options, callback); - } - -/** - * Streaming read of log entries as they are ingested. Until the stream is - * terminated, it will continue reading logs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and - * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async - */ - tailLogEntries( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.tailLogEntries(null, options); - } - - /** - * Lists log entries. Use this method to retrieve log entries that originated - * from a project/folder/organization/billing account. For ways to export log - * entries, see [Exporting - * Logs](https://cloud.google.com/logging/docs/export). - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>|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 || {}; - this.initialize(); - return this.innerApiCalls.listLogEntries(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogEntry|LogEntry} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogEntriesStream( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogEntries.createStream( - this.innerApiCalls.listLogEntries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogEntries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogEntry|LogEntry}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async - */ - listLogEntriesAsync( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogEntries.asyncIterate( - this.innerApiCalls['listLogEntries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the descriptors for monitored resource types used by Logging. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>|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 || {}; - this.initialize(); - return this.innerApiCalls.listMonitoredResourceDescriptors(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the logs in projects, organizations, folders, or billing accounts. - * Only logs that have entries are listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLogs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing string on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogsStream( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogs.createStream( - this.innerApiCalls.listLogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_logs.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async - */ - listLogsAsync( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogs.asyncIterate( - this.innerApiCalls['listLogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.loggingServiceV2Stub && !this._terminated) { - return this.loggingServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json deleted file mode 100644 index 342e96e9..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.LoggingServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "DeleteLog": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "WriteLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default", - "bundling": { - "element_count_threshold": 1000, - "request_byte_threshold": 1048576, - "delay_threshold_millis": 50, - "element_count_limit": 1000000 - } - }, - "ListLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListMonitoredResourceDescriptors": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListLogs": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "TailLogEntries": { - "timeout_millis": 3600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts deleted file mode 100644 index 39c5205d..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts +++ /dev/null @@ -1,2288 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/metrics_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './metrics_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring logs-based metrics. - * @class - * @memberof v2 - */ -export class MetricsServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricsServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricsServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new MetricsServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricsServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listLogMetrics: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.metricsServiceV2Stub) { - return this.metricsServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.MetricsServiceV2. - this.metricsServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.MetricsServiceV2, - 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 metricsServiceV2StubMethods = - ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; - for (const methodName of metricsServiceV2StubMethods) { - const callPromise = this.metricsServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.metricsServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - 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 -- - // ------------------- -/** - * Gets a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the desired metric: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async - */ - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLogMetric(request, options, callback); - } -/** - * Creates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project in which to create the metric: - * - * "projects/[PROJECT_ID]" - * - * The new metric must be provided in the request. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async - */ - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createLogMetric(request, options, callback); - } -/** - * Creates or updates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to update: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The updated metric. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async - */ - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateLogMetric(request, options, callback); - } -/** - * Deletes a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to delete: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async - */ - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLogMetric(request, options, callback); - } - - /** - * Lists logs-based metrics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLogMetrics(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogMetric|LogMetric} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogMetricsStream( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogMetrics.createStream( - this.innerApiCalls.listLogMetrics as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogMetrics`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogMetric|LogMetric}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.list_log_metrics.js - * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async - */ - listLogMetricsAsync( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogMetrics.asyncIterate( - this.innerApiCalls['listLogMetrics'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.metricsServiceV2Stub && !this._terminated) { - return this.metricsServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json deleted file mode 100644 index 014688ab..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.MetricsServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "ListLogMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.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 e3fe4bd9..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const logging = require('@google-cloud/logging'); - -function main() { - const configServiceV2Client = new logging.ConfigServiceV2Client(); - const loggingServiceV2Client = new logging.LoggingServiceV2Client(); - const metricsServiceV2Client = new logging.MetricsServiceV2Client(); -} - -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 a8f19533..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from '@google-cloud/logging'; - -// check that the client class type name can be used -function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { - client.close(); -} -function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { - client.close(); -} -function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const configServiceV2Client = new ConfigServiceV2Client(); - doStuffWithConfigServiceV2Client(configServiceV2Client); - // check that the client instance can be created - const loggingServiceV2Client = new LoggingServiceV2Client(); - doStuffWithLoggingServiceV2Client(loggingServiceV2Client); - // check that the client instance can be created - const metricsServiceV2Client = new MetricsServiceV2Client(); - doStuffWithMetricsServiceV2Client(metricsServiceV2Client); -} - -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 c8f81b25..00000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts deleted file mode 100644 index 1d67fad1..00000000 --- a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts +++ /dev/null @@ -1,6220 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as configservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConfigServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = configservicev2Module.v2.ConfigServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - await client.initialize(); - assert(client.configServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.configServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - 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 configservicev2Module.v2.ConfigServiceV2Client({ - 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('getBucket', () => { - it('invokes getBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); - const [response] = await client.getBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBucket(request), expectedError); - }); - }); - - describe('createBucket', () => { - it('invokes createBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); - const [response] = await client.createBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBucket(request), expectedError); - }); - }); - - describe('updateBucket', () => { - it('invokes updateBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); - const [response] = await client.updateBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBucket(request), expectedError); - }); - }); - - describe('deleteBucket', () => { - it('invokes deleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBucket(request), expectedError); - }); - }); - - describe('undeleteBucket', () => { - it('invokes undeleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.undeleteBucket(request), expectedError); - }); - }); - - describe('getView', () => { - it('invokes getView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCall(expectedResponse); - const [response] = await client.getView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getView(request), expectedError); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getView(request), expectedError); - }); - }); - - describe('createView', () => { - it('invokes createView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCall(expectedResponse); - const [response] = await client.createView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createView(request), expectedError); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createView(request), expectedError); - }); - }); - - describe('updateView', () => { - it('invokes updateView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); - const [response] = await client.updateView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateView(request), expectedError); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateView(request), expectedError); - }); - }); - - describe('deleteView', () => { - it('invokes deleteView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); - const [response] = await client.deleteView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteView( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteView(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteView(request), expectedError); - }); - }); - - describe('getSink', () => { - it('invokes getSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); - const [response] = await client.getSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSink(request), expectedError); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSink(request), expectedError); - }); - }); - - describe('createSink', () => { - it('invokes createSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); - const [response] = await client.createSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSink(request), expectedError); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSink(request), expectedError); - }); - }); - - describe('updateSink', () => { - it('invokes updateSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); - const [response] = await client.updateSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSink(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSink(request), expectedError); - }); - }); - - describe('deleteSink', () => { - it('invokes deleteSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSink(request), expectedError); - }); - }); - - describe('getLink', () => { - it('invokes getLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Link() - ); - client.innerApiCalls.getLink = stubSimpleCall(expectedResponse); - const [response] = await client.getLink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Link() - ); - client.innerApiCalls.getLink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLink(request), expectedError); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLink(request), expectedError); - }); - }); - - describe('getExclusion', () => { - it('invokes getExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.getExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExclusion(request), expectedError); - }); - }); - - describe('createExclusion', () => { - it('invokes createExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.createExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExclusion(request), expectedError); - }); - }); - - describe('updateExclusion', () => { - it('invokes updateExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.updateExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateExclusion(request), expectedError); - }); - }); - - describe('deleteExclusion', () => { - it('invokes deleteExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExclusion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteExclusion(request), expectedError); - }); - }); - - describe('getCmekSettings', () => { - it('invokes getCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCmekSettings(request), expectedError); - }); - }); - - describe('updateCmekSettings', () => { - it('invokes updateCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCmekSettings(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSettings(request), expectedError); - }); - }); - - describe('createBucketAsync', () => { - it('invokes createBucketAsync without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBucketAsync(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBucketAsync = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucketAsync( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBucketAsync(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBucketAsync(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBucketAsyncProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBucketAsyncProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBucketAsyncProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBucketAsyncProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBucketAsync', () => { - it('invokes updateBucketAsync without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBucketAsync(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBucketAsync = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucketAsync( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBucketAsync(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBucketAsync(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateBucketAsyncProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateBucketAsyncProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBucketAsyncProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBucketAsyncProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createLink', () => { - it('invokes createLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.createLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createLink(request), expectedError); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateLinkProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateLinkProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteLink', () => { - it('invokes deleteLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteLink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteLinkProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteLinkProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('copyLogEntries', () => { - it('invokes copyLogEntries without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); - const [operation] = await client.copyLogEntries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.copyLogEntries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.copyLogEntries(request), expectedError); - }); - - it('invokes copyLogEntries with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.copyLogEntries(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkCopyLogEntriesProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCopyLogEntriesProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuckets', () => { - it('invokes listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); - const [response] = await client.listBuckets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuckets( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuckets(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBucketsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBucketsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogBucket[] = []; - const iterable = client.listBucketsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBucketsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogBucket[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listViews', () => { - it('invokes listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); - const [response] = await client.listViews(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listViews( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listViews(request), expectedError); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViewsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listViewsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogView[] = []; - const iterable = client.listViewsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listViewsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogView[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSinks', () => { - it('invokes listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); - const [response] = await client.listSinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogSink[] = []; - const iterable = client.listSinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogSink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listLinks', () => { - it('invokes listLinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.innerApiCalls.listLinks = stubSimpleCall(expectedResponse); - const [response] = await client.listLinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.innerApiCalls.listLinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.descriptors.page.listLinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.Link[] = []; - stream.on('data', (response: protos.google.logging.v2.Link) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); - assert( - (client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.Link[] = []; - stream.on('data', (response: protos.google.logging.v2.Link) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); - assert( - (client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILink[] = []; - const iterable = client.listLinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listExclusions', () => { - it('invokes listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); - const [response] = await client.listExclusions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExclusions( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExclusions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusionsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExclusionsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogExclusion[] = []; - const iterable = client.listExclusionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExclusionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogExclusion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts deleted file mode 100644 index 268928df..00000000 --- a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts +++ /dev/null @@ -1,2415 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as loggingservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.LoggingServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - await client.initialize(); - assert(client.loggingServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.loggingServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - 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 loggingservicev2Module.v2.LoggingServiceV2Client({ - 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('deleteLog', () => { - it('invokes deleteLog without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLog( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLog(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteLog(request), expectedError); - }); - }); - - describe('writeLogEntries', () => { - it('invokes writeLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.writeLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - - it('invokes writeLogEntries with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - }); - - describe('tailLogEntries', () => { - it('invokes tailLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesResponse() - ); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes tailLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('listLogEntries', () => { - it('invokes listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.listLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogEntries(request), expectedError); - }); - - it('invokes listLogEntriesStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('invokes listLogEntriesStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('uses async iteration with listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogEntry[] = []; - const iterable = client.listLogEntriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogEntriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listLogs', () => { - it('invokes listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); - const [response] = await client.listLogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogs( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.listLogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts deleted file mode 100644 index 6904bceb..00000000 --- a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts +++ /dev/null @@ -1,2257 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricsservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.MetricsServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - await client.initialize(); - assert(client.metricsServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.metricsServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - 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 metricsservicev2Module.v2.MetricsServiceV2Client({ - 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('getLogMetric', () => { - it('invokes getLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.getLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLogMetric(request), expectedError); - }); - }); - - describe('createLogMetric', () => { - it('invokes createLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.createLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createLogMetric(request), expectedError); - }); - }); - - describe('updateLogMetric', () => { - it('invokes updateLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.updateLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateLogMetric(request), expectedError); - }); - }); - - describe('deleteLogMetric', () => { - it('invokes deleteLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLogMetric( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteLogMetric(request), expectedError); - }); - }); - - describe('listLogMetrics', () => { - it('invokes listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); - const [response] = await client.listLogMetrics(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogMetrics( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetricsStream without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogMetricsStream with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogMetric[] = []; - const iterable = client.listLogMetricsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogMetricsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogMetric[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- 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 a37e80e5..00000000 --- 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: 'logging', - filename: './logging.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/v2/config_service_v2_client.ts b/src/v2/config_service_v2_client.ts index c903a739..43ac9f7a 100644 --- a/src/v2/config_service_v2_client.ts +++ b/src/v2/config_service_v2_client.ts @@ -93,8 +93,7 @@ export class ConfigServiceV2Client { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you @@ -102,7 +101,7 @@ export class ConfigServiceV2Client { * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConfigServiceV2Client({fallback: 'rest'}, gax); + * const client = new ConfigServiceV2Client({fallback: true}, gax); * ``` */ constructor( @@ -168,7 +167,7 @@ export class ConfigServiceV2Client { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -332,7 +331,7 @@ export class ConfigServiceV2Client { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; - if (opts.fallback === 'rest') { + if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { diff --git a/src/v2/logging_service_v2_client.ts b/src/v2/logging_service_v2_client.ts index 87ec5d5f..789bcaff 100644 --- a/src/v2/logging_service_v2_client.ts +++ b/src/v2/logging_service_v2_client.ts @@ -90,8 +90,7 @@ export class LoggingServiceV2Client { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you @@ -99,7 +98,7 @@ export class LoggingServiceV2Client { * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new LoggingServiceV2Client({fallback: 'rest'}, gax); + * const client = new LoggingServiceV2Client({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class LoggingServiceV2Client { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -313,7 +312,7 @@ export class LoggingServiceV2Client { this.descriptors.stream = { tailLogEntries: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.BIDI_STREAMING, - opts.fallback === 'rest' + !!opts.fallback ), }; diff --git a/src/v2/metrics_service_v2_client.ts b/src/v2/metrics_service_v2_client.ts index 94306d29..11e4d4fb 100644 --- a/src/v2/metrics_service_v2_client.ts +++ b/src/v2/metrics_service_v2_client.ts @@ -90,8 +90,7 @@ export class MetricsServiceV2Client { * 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. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you @@ -99,7 +98,7 @@ export class MetricsServiceV2Client { * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new MetricsServiceV2Client({fallback: 'rest'}, gax); + * const client = new MetricsServiceV2Client({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class MetricsServiceV2Client { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { From 5767762ffe2db0fab62ab238303279b638f71829 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 26 Sep 2023 22:52:01 +0000 Subject: [PATCH 3/5] build: update typescript generator version to publish in dual format (ESM) PiperOrigin-RevId: 568643156 Source-Link: https://github.com/googleapis/googleapis/commit/f95afc063e20a0a61e13b186806ac84b49e329cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/bbd2c49d2e423a8ce5cc85627402d512aeefc58b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmJkMmM0OWQyZTQyM2E4Y2U1Y2M4NTYyNzQwMmQ1MTJhZWVmYzU4YiJ9 --- 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/package.json | 60 + .../protos/google/logging/v2/log_entry.proto | 280 + .../v2/protos/google/logging/v2/logging.proto | 483 ++ .../google/logging/v2/logging_config.proto | 2317 ++++++ .../google/logging/v2/logging_metrics.proto | 339 + .../v2/config_service_v2.copy_log_entries.js | 74 + .../v2/config_service_v2.create_bucket.js | 78 + .../config_service_v2.create_bucket_async.js | 79 + .../v2/config_service_v2.create_exclusion.js | 74 + .../v2/config_service_v2.create_link.js | 78 + .../v2/config_service_v2.create_sink.js | 88 + .../v2/config_service_v2.create_view.js | 76 + .../v2/config_service_v2.delete_bucket.js | 67 + .../v2/config_service_v2.delete_exclusion.js | 67 + .../v2/config_service_v2.delete_link.js | 66 + .../v2/config_service_v2.delete_sink.js | 68 + .../v2/config_service_v2.delete_view.js | 64 + .../v2/config_service_v2.get_bucket.js | 67 + .../v2/config_service_v2.get_cmek_settings.js | 71 + .../v2/config_service_v2.get_exclusion.js | 67 + .../v2/config_service_v2.get_link.js | 65 + .../v2/config_service_v2.get_settings.js | 71 + .../v2/config_service_v2.get_sink.js | 67 + .../v2/config_service_v2.get_view.js | 64 + .../v2/config_service_v2.list_buckets.js | 83 + .../v2/config_service_v2.list_exclusions.js | 80 + .../v2/config_service_v2.list_links.js | 77 + .../v2/config_service_v2.list_sinks.js | 80 + .../v2/config_service_v2.list_views.js | 77 + .../v2/config_service_v2.undelete_bucket.js | 67 + .../v2/config_service_v2.update_bucket.js | 82 + .../config_service_v2.update_bucket_async.js | 83 + .../config_service_v2.update_cmek_settings.js | 86 + .../v2/config_service_v2.update_exclusion.js | 84 + .../v2/config_service_v2.update_settings.js | 83 + .../v2/config_service_v2.update_sink.js | 101 + .../v2/config_service_v2.update_view.js | 78 + .../v2/logging_service_v2.delete_log.js | 70 + .../v2/logging_service_v2.list_log_entries.js | 106 + .../v2/logging_service_v2.list_logs.js | 94 + ..._v2.list_monitored_resource_descriptors.js | 71 + .../v2/logging_service_v2.tail_log_entries.js | 89 + .../logging_service_v2.write_log_entries.js | 129 + .../metrics_service_v2.create_log_metric.js | 69 + .../metrics_service_v2.delete_log_metric.js | 62 + .../v2/metrics_service_v2.get_log_metric.js | 62 + .../v2/metrics_service_v2.list_log_metrics.js | 77 + .../metrics_service_v2.update_log_metric.js | 70 + .../snippet_metadata_google.logging.v2.json | 1963 ++++++ owl-bot-staging/v2/src/index.ts | 29 + .../v2/src/v2/config_service_v2_client.ts | 5530 +++++++++++++++ .../v2/config_service_v2_client_config.json | 169 + .../src/v2/config_service_v2_proto_list.json | 8 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 512 ++ owl-bot-staging/v2/src/v2/index.ts | 21 + .../v2/src/v2/logging_service_v2_client.ts | 2754 ++++++++ .../v2/logging_service_v2_client_config.json | 67 + .../src/v2/logging_service_v2_proto_list.json | 8 + .../v2/src/v2/metrics_service_v2_client.ts | 2288 ++++++ .../v2/metrics_service_v2_client_config.json | 56 + .../src/v2/metrics_service_v2_proto_list.json | 8 + .../system-test/fixtures/sample/src/index.js | 29 + .../system-test/fixtures/sample/src/index.ts | 44 + owl-bot-staging/v2/system-test/install.ts | 49 + .../v2/test/gapic_config_service_v2_v2.ts | 6220 +++++++++++++++++ .../v2/test/gapic_logging_service_v2_v2.ts | 2415 +++++++ .../v2/test/gapic_metrics_service_v2_v2.ts | 2257 ++++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 + 76 files changed, 31435 insertions(+) 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/package.json create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto create mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_metrics.proto create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json create mode 100644 owl-bot-staging/v2/src/index.ts create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json 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/logging_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_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_config_service_v2_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_metrics_service_v2_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/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /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 00000000..78215349 --- /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 00000000..d4f03a0d --- /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 00000000..9e6e0612 --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/logging', + 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 00000000..1a38f257 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js new file mode 100644 index 00000000..55639e70 --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md new file mode 100644 index 00000000..bdf6f36e --- /dev/null +++ b/owl-bot-staging/v2/README.md @@ -0,0 +1 @@ +Logging: Nodejs Client diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 00000000..a6bd705c --- /dev/null +++ b/owl-bot-staging/v2/package.json @@ -0,0 +1,60 @@ +{ + "name": "@google-cloud/logging", + "version": "0.1.0", + "description": "Logging client for Node.js", + "repository": "googleapis/nodejs-logging", + "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 logging", + "logging", + "config service v2", + "logging service v2", + "metrics service v2" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.4" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.17", + "c8": "^8.0.1", + "gapic-tools": "^0.2.0", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-fresh": "^3.0.0", + "jsdoc-region-tag": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto new file mode 100644 index 00000000..94c5cdff --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto @@ -0,0 +1,280 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/field_behavior.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/logging/type/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 cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; + +// An individual entry in a log. +message LogEntry { + option (google.api.resource) = { + type: "logging.googleapis.com/Log" + pattern: "projects/{project}/logs/{log}" + pattern: "organizations/{organization}/logs/{log}" + pattern: "folders/{folder}/logs/{log}" + pattern: "billingAccounts/{billing_account}/logs/{log}" + name_field: "log_name" + }; + + // Required. The resource name of the log to which this log entry belongs: + // + // "projects/[PROJECT_ID]/logs/[LOG_ID]" + // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + // "folders/[FOLDER_ID]/logs/[LOG_ID]" + // + // A project number may be used in place of PROJECT_ID. The project number is + // translated to its corresponding PROJECT_ID internally and the `log_name` + // field will contain PROJECT_ID in queries and exports. + // + // `[LOG_ID]` must be URL-encoded within `log_name`. Example: + // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + // + // `[LOG_ID]` must be less than 512 characters long and can only include the + // following characters: upper and lower case alphanumeric characters, + // forward-slash, underscore, hyphen, and period. + // + // For backward compatibility, if `log_name` begins with a forward-slash, such + // as `/projects/...`, then the log entry is ingested as usual, but the + // forward-slash is removed. Listing the log entry will not show the leading + // slash and filtering for a log name with a leading slash will never return + // any results. + string log_name = 12 [(google.api.field_behavior) = REQUIRED]; + + // Required. The monitored resource that produced this log entry. + // + // Example: a log entry that reports a database error would be associated with + // the monitored resource designating the particular database that reported + // the error. + google.api.MonitoredResource resource = 8 + [(google.api.field_behavior) = REQUIRED]; + + // The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer. Some Google + // Cloud Platform services use this field for their log entry payloads. + // + // The following protocol buffer types are supported; user-defined types + // are not supported: + // + // "type.googleapis.com/google.cloud.audit.AuditLog" + // "type.googleapis.com/google.appengine.logging.v1.RequestLog" + 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 json_payload = 6; + } + + // Optional. The time the event described by the log entry occurred. This time + // is used to compute the log entry's age and to enforce the logs retention + // period. If this field is omitted in a new log entry, then Logging assigns + // it the current time. Timestamps have nanosecond accuracy, but trailing + // zeros in the fractional seconds might be omitted when the timestamp is + // displayed. + // + // Incoming log entries must have timestamps that don't exceed the + // [logs retention + // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in + // the past, and that don't exceed 24 hours in the future. Log entries outside + // those time boundaries aren't ingested by Logging. + google.protobuf.Timestamp timestamp = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time the log entry was received by Logging. + google.protobuf.Timestamp receive_timestamp = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique identifier for the log entry. If you provide a value, + // then Logging considers other log entries in the same project, with the same + // `timestamp`, and with the same `insert_id` to be duplicates which are + // removed in a single query result. However, there are no guarantees of + // de-duplication in the export of logs. + // + // If the `insert_id` is omitted when writing a log entry, the Logging API + // assigns its own unique identifier in this field. + // + // In queries, the `insert_id` is also used to order log entries that have + // the same `log_name` and `timestamp` values. + string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information about the HTTP request associated with this log + // entry, if applicable. + google.logging.type.HttpRequest http_request = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A map of key, value pairs that provides additional information + // about the log entry. The labels can be user-defined or system-defined. + // + // User-defined labels are arbitrary key, value pairs that you can use to + // classify logs. + // + // System-defined labels are defined by GCP services for platform logs. + // They have two components - a service namespace component and the + // attribute name. For example: `compute.googleapis.com/resource_name`. + // + // Cloud Logging truncates label keys that exceed 512 B and label + // values that exceed 64 KB upon their associated log entry being + // written. The truncation is indicated by an ellipsis at the + // end of the character string. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information about an operation associated with the log entry, if + // applicable. + LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The REST resource name of the trace being written to + // [Cloud Trace](https://cloud.google.com/trace) in + // association with this log entry. For example, if your trace data is stored + // in the Cloud project "my-trace-project" and if the service that is creating + // the log entry receives a trace header that includes the trace ID "12345", + // then the service should use "projects/my-tracing-project/traces/12345". + // + // The `trace` field provides the link between logs and traces. By using + // this field, you can navigate from a log entry to a trace. + string trace = 22 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span + // associated with the current operation in which the log is being written. + // For example, if a span has the REST resource name of + // "projects/some-project/traces/some-trace/spans/some-span-id", then the + // `span_id` field is "some-span-id". + // + // A + // [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span) + // represents a single operation within a trace. Whereas a trace may involve + // multiple different microservices running on multiple different machines, + // a span generally corresponds to a single logical operation being performed + // in a single instance of a microservice on one specific machine. Spans + // are the nodes within the tree that is a trace. + // + // Applications that are [instrumented for + // tracing](https://cloud.google.com/trace/docs/setup) will generally assign a + // new, unique span ID on each incoming request. It is also common to create + // and record additional spans corresponding to internal processing elements + // as well as issuing requests to dependencies. + // + // The span ID is expected to be a 16-character, hexadecimal encoding of an + // 8-byte array and should not be zero. It should be unique within the trace + // and should, ideally, be generated in a manner that is uniformly random. + // + // Example values: + // + // - `000000000000004a` + // - `7a2190356c3fc94b` + // - `0000f00300090021` + // - `d39223e101960076` + string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The sampling decision of the trace associated with the log entry. + // + // True means that the trace resource name in the `trace` field was sampled + // for storage in a trace backend. False means that the trace was not sampled + // for storage when this log entry was written, or the sampling decision was + // unknown at the time. A non-sampled `trace` value is still useful as a + // request correlation identifier. The default is False. + bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Source code location information associated with the log entry, + // if any. + LogEntrySourceLocation source_location = 23 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information indicating this LogEntry is part of a sequence of + // multiple log entries split from a single LogEntry. + LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; +} + +// 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 [(google.api.field_behavior) = OPTIONAL]; + + // 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 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Set this to True if this is the first log entry in the operation. + bool first = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Set this to True if this is the last log entry in the operation. + bool last = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// 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 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Line within the source file. 1-based; 0 indicates no line number + // available. + int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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 [(google.api.field_behavior) = OPTIONAL]; +} + +// Additional information used to correlate multiple log entries. Used when a +// single LogEntry would exceed the Google Cloud Logging size limit and is +// split across multiple log entries. +message LogSplit { + // A globally unique identifier for all log entries in a sequence of split log + // entries. All log entries with the same |LogSplit.uid| are assumed to be + // part of the same sequence of split log entries. + string uid = 1; + + // The index of this LogEntry in the sequence of split log entries. Log + // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log + // entries. + int32 index = 2; + + // The total number of log entries that the original LogEntry was split into. + int32 total_splits = 3; +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto new file mode 100644 index 00000000..92d481ea --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto @@ -0,0 +1,483 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/logging/v2/log_entry.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LoggingProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; + +// Service for ingesting and querying logs. +service LoggingServiceV2 { + option (google.api.default_host) = "logging.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/logging.admin," + "https://www.googleapis.com/auth/logging.read," + "https://www.googleapis.com/auth/logging.write"; + + // Deletes all the log entries in a log for the _Default Log Bucket. The log + // reappears if it receives new entries. Log entries written shortly before + // the delete operation might not be deleted. Entries received after the + // delete operation with a timestamp before the operation will be deleted. + rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{log_name=projects/*/logs/*}" + additional_bindings { delete: "/v2/{log_name=*/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=organizations/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=folders/*/logs/*}" } + additional_bindings { delete: "/v2/{log_name=billingAccounts/*/logs/*}" } + }; + option (google.api.method_signature) = "log_name"; + } + + // Writes log entries to Logging. This API method is the + // only way to send log entries to Logging. This method + // is used, directly or indirectly, by the Logging agent + // (fluentd) and all logging libraries configured to use Logging. + // A single request may contain log entries for a maximum of 1000 + // different resources (projects, organizations, billing accounts or + // folders) + rpc WriteLogEntries(WriteLogEntriesRequest) + returns (WriteLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:write" + body: "*" + }; + option (google.api.method_signature) = "log_name,resource,labels,entries"; + } + + // Lists log entries. Use this method to retrieve log entries that originated + // from a project/folder/organization/billing account. For ways to export log + // entries, see [Exporting + // Logs](https://cloud.google.com/logging/docs/export). + rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:list" + body: "*" + }; + option (google.api.method_signature) = "resource_names,filter,order_by"; + } + + // Lists the descriptors for monitored resource types used by Logging. + rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) + returns (ListMonitoredResourceDescriptorsResponse) { + option (google.api.http) = { + get: "/v2/monitoredResourceDescriptors" + }; + } + + // Lists the logs in projects, organizations, folders, or billing accounts. + // Only logs that have entries are listed. + rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/logs" + additional_bindings { get: "/v2/{parent=projects/*}/logs" } + additional_bindings { get: "/v2/{parent=organizations/*}/logs" } + additional_bindings { get: "/v2/{parent=folders/*}/logs" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/logs" } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Streaming read of log entries as they are ingested. Until the stream is + // terminated, it will continue reading logs. + rpc TailLogEntries(stream TailLogEntriesRequest) + returns (stream TailLogEntriesResponse) { + option (google.api.http) = { + post: "/v2/entries:tail" + body: "*" + }; + } +} + +// The parameters to DeleteLog. +message DeleteLogRequest { + // Required. The resource name of the log to delete: + // + // * `projects/[PROJECT_ID]/logs/[LOG_ID]` + // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + // * `folders/[FOLDER_ID]/logs/[LOG_ID]` + // + // `[LOG_ID]` must be URL-encoded. For example, + // `"projects/my-project-id/logs/syslog"`, + // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + // + // For more information about log names, see + // [LogEntry][google.logging.v2.LogEntry]. + string log_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } + ]; +} + +// The parameters to WriteLogEntries. +message WriteLogEntriesRequest { + // Optional. A default log resource name that is assigned to all log entries + // in `entries` that do not specify a value for `log_name`: + // + // * `projects/[PROJECT_ID]/logs/[LOG_ID]` + // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + // * `folders/[FOLDER_ID]/logs/[LOG_ID]` + // + // `[LOG_ID]` must be URL-encoded. For example: + // + // "projects/my-project-id/logs/syslog" + // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + // + // The permission `logging.logEntries.create` is needed on each project, + // organization, billing account, or folder that is receiving new log + // entries, whether the resource is specified in `logName` or in an + // individual log entry. + string log_name = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } + ]; + + // Optional. A default monitored resource object that is assigned to all log + // entries in `entries` that do not specify a value for `resource`. Example: + // + // { "type": "gce_instance", + // "labels": { + // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + // + // See [LogEntry][google.logging.v2.LogEntry]. + google.api.MonitoredResource resource = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Default labels that are added to the `labels` field of all log + // entries in `entries`. If a log entry already has a label with the same key + // as a label in this parameter, then the log entry's label is not changed. + // See [LogEntry][google.logging.v2.LogEntry]. + map labels = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The log entries to send to Logging. The order of log + // entries in this list does not matter. Values supplied in this method's + // `log_name`, `resource`, and `labels` fields are copied into those log + // entries in this list that do not include values for their corresponding + // fields. For more information, see the + // [LogEntry][google.logging.v2.LogEntry] type. + // + // If the `timestamp` or `insert_id` fields are missing in log entries, then + // this method supplies the current time or a unique identifier, respectively. + // The supplied values are chosen so that, among the log entries that did not + // supply their own values, the entries earlier in the list will sort before + // the entries later in the list. See the `entries.list` method. + // + // Log entries with timestamps that are more than the + // [logs retention period](https://cloud.google.com/logging/quotas) in + // the past or more than 24 hours in the future will not be available when + // calling `entries.list`. However, those log entries can still be [exported + // with + // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + // + // To improve throughput and to avoid exceeding the + // [quota limit](https://cloud.google.com/logging/quotas) for calls to + // `entries.write`, you should try to include several log entries in this + // list, rather than calling this method for each individual log entry. + repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether a batch's valid entries should be written even if some + // other entry failed due to a permanent error such as INVALID_ARGUMENT or + // PERMISSION_DENIED. If any entry failed, then the response status is the + // response status of one of the failed entries. The response will include + // error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + // the entries' zero-based index in the `entries`. Failed requests for which + // no entries are written will not include per-entry errors. + bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the request should expect normal response, but the + // entries won't be persisted nor exported. Useful for checking whether the + // logging API endpoints are working properly before sending valuable data. + bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from WriteLogEntries. +message WriteLogEntriesResponse {} + +// Error details for WriteLogEntries with partial success. +message WriteLogEntriesPartialErrors { + // When `WriteLogEntriesRequest.partial_success` is true, records the error + // status for entries that were not written due to a permanent error, keyed + // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. + // + // Failed requests for which no entries are written will not include + // per-entry errors. + map log_entry_errors = 1; +} + +// The parameters to `ListLogEntries`. +message ListLogEntriesRequest { + // Required. Names of one or more parent resources from which to + // retrieve log entries: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // May alternatively be one or more views: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // + // Projects listed in the `project_ids` field are added to this list. + // A maximum of 100 resources may be specified in a single request. + repeated string resource_names = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. Only log entries that match the filter are returned. An empty + // filter matches all log entries in the resources listed in `resource_names`. + // Referencing a parent resource that is not listed in `resource_names` will + // cause the filter to return no results. The maximum length of a filter is + // 20,000 characters. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. How the results should be sorted. Presently, the only permitted + // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + // option returns entries in order of increasing values of + // `LogEntry.timestamp` (oldest first), and the second option returns entries + // in order of decreasing timestamps (newest first). Entries with equal + // timestamps are returned in order of their `insert_id` values. + string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Default is 50. If the value is negative or exceeds 1000, the request is + // rejected. The presence of `next_page_token` in the response indicates that + // more results might be available. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `ListLogEntries`. +message ListLogEntriesResponse { + // A list of log entries. If `entries` is empty, `nextPageToken` may still be + // returned, indicating that more entries may exist. See `nextPageToken` for + // more information. + repeated LogEntry entries = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + // + // If a value for `next_page_token` appears and the `entries` field is empty, + // it means that the search found no log entries so far but it did not have + // time to search all the possible log entries. Retry the method with this + // value for `page_token` to continue the search. Alternatively, consider + // speeding up the search by changing your filter to specify a single log name + // or resource type, or to narrow the time range of the search. + string next_page_token = 2; +} + +// The parameters to ListMonitoredResourceDescriptors +message ListMonitoredResourceDescriptorsRequest { + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListMonitoredResourceDescriptors. +message ListMonitoredResourceDescriptorsResponse { + // A list of resource descriptors. + repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to ListLogs. +message ListLogsRequest { + // Required. The resource name to list logs for: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. List of resource names to list logs for: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // + // To support legacy queries, it could also be: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // The resource name in the `parent` field is added to this list. + repeated string resource_names = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Log" + } + ]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListLogs. +message ListLogsResponse { + // A list of log names. For example, + // `"projects/my-project/logs/syslog"` or + // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + repeated string log_names = 3; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `TailLogEntries`. +message TailLogEntriesRequest { + // Required. Name of a parent resource from which to retrieve log entries: + // + // * `projects/[PROJECT_ID]` + // * `organizations/[ORGANIZATION_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]` + // * `folders/[FOLDER_ID]` + // + // May alternatively be one or more views: + // + // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Only log entries that match the filter are returned. An empty + // filter matches all log entries in the resources listed in `resource_names`. + // Referencing a parent resource that is not listed in `resource_names` will + // cause the filter to return no results. The maximum length of a filter is + // 20,000 characters. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The amount of time to buffer log entries at the server before + // being returned to prevent out of order results due to late arriving log + // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 + // milliseconds. + google.protobuf.Duration buffer_window = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `TailLogEntries`. +message TailLogEntriesResponse { + // Information about entries that were omitted from the session. + message SuppressionInfo { + // An indicator of why entries were omitted. + enum Reason { + // Unexpected default. + REASON_UNSPECIFIED = 0; + + // Indicates suppression occurred due to relevant entries being + // received in excess of rate limits. For quotas and limits, see + // [Logging API quotas and + // limits](https://cloud.google.com/logging/quotas#api-limits). + RATE_LIMIT = 1; + + // Indicates suppression occurred due to the client not consuming + // responses quickly enough. + NOT_CONSUMED = 2; + } + + // The reason that entries were omitted from the session. + Reason reason = 1; + + // A lower bound on the count of entries omitted due to `reason`. + int32 suppressed_count = 2; + } + + // A list of log entries. Each response in the stream will order entries with + // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed + // between separate responses. + repeated LogEntry entries = 1; + + // If entries that otherwise would have been included in the session were not + // sent back to the client, counts of relevant entries omitted from the + // session with the reason that they were not included. There will be at most + // one of each reason per response. The counts represent the number of + // suppressed entries since the last streamed response. + repeated SuppressionInfo suppression_info = 2; +} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto new file mode 100644 index 00000000..cc7677b1 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto @@ -0,0 +1,2317 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; +option java_multiple_files = true; +option java_outer_classname = "LoggingConfigProto"; +option java_package = "com.google.logging.v2"; +option php_namespace = "Google\\Cloud\\Logging\\V2"; +option ruby_package = "Google::Cloud::Logging::V2"; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/OrganizationLocation" + pattern: "organizations/{organization}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/FolderLocation" + pattern: "folders/{folder}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "logging.googleapis.com/BillingAccountLocation" + pattern: "billingAccounts/{billing_account}/locations/{location}" +}; + +// Service for configuring sinks used to route log entries. +service ConfigServiceV2 { + option (google.api.default_host) = "logging.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/logging.admin," + "https://www.googleapis.com/auth/logging.read"; + + // Lists log buckets. + rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*}/buckets" + additional_bindings { get: "/v2/{parent=projects/*/locations/*}/buckets" } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/buckets" + } + additional_bindings { get: "/v2/{parent=folders/*/locations/*}/buckets" } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a log bucket. + rpc GetBucket(GetBucketRequest) returns (LogBucket) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*}" + additional_bindings { get: "/v2/{name=projects/*/locations/*/buckets/*}" } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*}" + } + additional_bindings { get: "/v2/{name=folders/*/locations/*/buckets/*}" } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + } + }; + } + + // Creates a log bucket asynchronously that can be used to store log entries. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc CreateBucketAsync(CreateBucketRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*}/buckets:createAsync" + body: "bucket" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*}/buckets:createAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync" + body: "bucket" + } + }; + option (google.longrunning.operation_info) = { + response_type: "LogBucket" + metadata_type: "BucketMetadata" + }; + } + + // Updates a log bucket asynchronously. + // + // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + // `FAILED_PRECONDITION` will be returned. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc UpdateBucketAsync(UpdateBucketRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=*/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=folders/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + additional_bindings { + post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync" + body: "bucket" + } + }; + option (google.longrunning.operation_info) = { + response_type: "LogBucket" + metadata_type: "BucketMetadata" + }; + } + + // Creates a log bucket that can be used to store log entries. After a bucket + // has been created, the bucket's location cannot be changed. + rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*}/buckets" + body: "bucket" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*}/buckets" + body: "bucket" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" + body: "bucket" + } + }; + } + + // Updates a log bucket. + // + // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + // `FAILED_PRECONDITION` will be returned. + // + // After a bucket has been created, the bucket's location cannot be changed. + rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { + option (google.api.http) = { + patch: "/v2/{name=*/*/locations/*/buckets/*}" + body: "bucket" + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=folders/*/locations/*/buckets/*}" + body: "bucket" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + body: "bucket" + } + }; + } + + // Deletes a log bucket. + // + // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. + // After 7 days, the bucket will be purged and all log entries in the bucket + // will be permanently deleted. + rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" + } + }; + } + + // Undeletes a log bucket. A bucket that has been deleted can be undeleted + // within the grace period of 7 days. + rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" + body: "*" + } + additional_bindings { + post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" + body: "*" + } + }; + } + + // Lists views on a log bucket. + rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*/buckets/*}/views" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a view on a log bucket.. + rpc GetView(GetViewRequest) returns (LogView) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + } + }; + } + + // Creates a view over log entries in a log bucket. A bucket may contain a + // maximum of 30 views. + rpc CreateView(CreateViewRequest) returns (LogView) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*/buckets/*}/views" + body: "view" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" + body: "view" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" + body: "view" + } + }; + } + + // Updates a view on a log bucket. This method replaces the following fields + // in the existing view with values from the new view: `filter`. + // If an `UNAVAILABLE` error is returned, this indicates that system is not in + // a state where it can update the view. If this occurs, please try again in a + // few minutes. + rpc UpdateView(UpdateViewRequest) returns (LogView) { + option (google.api.http) = { + patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + body: "view" + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + body: "view" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + body: "view" + } + }; + } + + // Deletes a view on a log bucket. + // If an `UNAVAILABLE` error is returned, this indicates that system is not in + // a state where it can delete the view. If this occurs, please try again in a + // few minutes. + rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" + } + }; + } + + // Lists sinks. + rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/sinks" + additional_bindings { get: "/v2/{parent=projects/*}/sinks" } + additional_bindings { get: "/v2/{parent=organizations/*}/sinks" } + additional_bindings { get: "/v2/{parent=folders/*}/sinks" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/sinks" } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a sink. + rpc GetSink(GetSinkRequest) returns (LogSink) { + option (google.api.http) = { + get: "/v2/{sink_name=*/*/sinks/*}" + additional_bindings { get: "/v2/{sink_name=projects/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=organizations/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=folders/*/sinks/*}" } + additional_bindings { get: "/v2/{sink_name=billingAccounts/*/sinks/*}" } + }; + option (google.api.method_signature) = "sink_name"; + } + + // Creates a sink that exports specified log entries to a destination. The + // export of newly-ingested log entries begins immediately, unless the sink's + // `writer_identity` is not permitted to write to the destination. A sink can + // export log entries only from the resource owning the sink. + rpc CreateSink(CreateSinkRequest) returns (LogSink) { + option (google.api.http) = { + post: "/v2/{parent=*/*}/sinks" + body: "sink" + additional_bindings { post: "/v2/{parent=projects/*}/sinks" body: "sink" } + additional_bindings { + post: "/v2/{parent=organizations/*}/sinks" + body: "sink" + } + additional_bindings { post: "/v2/{parent=folders/*}/sinks" body: "sink" } + additional_bindings { + post: "/v2/{parent=billingAccounts/*}/sinks" + body: "sink" + } + }; + option (google.api.method_signature) = "parent,sink"; + } + + // Updates a sink. This method replaces the following fields in the existing + // sink with values from the new sink: `destination`, and `filter`. + // + // The updated sink might also have a new `writer_identity`; see the + // `unique_writer_identity` field. + rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { + option (google.api.http) = { + put: "/v2/{sink_name=*/*/sinks/*}" + body: "sink" + additional_bindings { + put: "/v2/{sink_name=projects/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=organizations/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=folders/*/sinks/*}" + body: "sink" + } + additional_bindings { + put: "/v2/{sink_name=billingAccounts/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=projects/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=organizations/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=folders/*/sinks/*}" + body: "sink" + } + additional_bindings { + patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" + body: "sink" + } + }; + option (google.api.method_signature) = "sink_name,sink,update_mask"; + option (google.api.method_signature) = "sink_name,sink"; + } + + // Deletes a sink. If the sink has a unique `writer_identity`, then that + // service account is also deleted. + rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{sink_name=*/*/sinks/*}" + additional_bindings { delete: "/v2/{sink_name=projects/*/sinks/*}" } + additional_bindings { delete: "/v2/{sink_name=organizations/*/sinks/*}" } + additional_bindings { delete: "/v2/{sink_name=folders/*/sinks/*}" } + additional_bindings { + delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" + } + }; + option (google.api.method_signature) = "sink_name"; + } + + // Asynchronously creates a linked dataset in BigQuery which makes it possible + // to use BigQuery to read the logs stored in the log bucket. A log bucket may + // currently only contain one link. + rpc CreateLink(CreateLinkRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=*/*/locations/*/buckets/*}/links" + body: "link" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=folders/*/locations/*/buckets/*}/links" + body: "link" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" + body: "link" + } + }; + option (google.api.method_signature) = "parent,link,link_id"; + option (google.longrunning.operation_info) = { + response_type: "Link" + metadata_type: "LinkMetadata" + }; + } + + // Deletes a link. This will also delete the corresponding BigQuery linked + // dataset. + rpc DeleteLink(DeleteLinkRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=*/*/locations/*/buckets/*/links/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "LinkMetadata" + }; + } + + // Lists links. + rpc ListLinks(ListLinksRequest) returns (ListLinksResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*/locations/*/buckets/*}/links" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=folders/*/locations/*/buckets/*}/links" + } + additional_bindings { + get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a link. + rpc GetLink(GetLinkRequest) returns (Link) { + option (google.api.http) = { + get: "/v2/{name=*/*/locations/*/buckets/*/links/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" + } + additional_bindings { + get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the exclusions on the _Default sink in a parent resource. + rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=*/*}/exclusions" + additional_bindings { get: "/v2/{parent=projects/*}/exclusions" } + additional_bindings { get: "/v2/{parent=organizations/*}/exclusions" } + additional_bindings { get: "/v2/{parent=folders/*}/exclusions" } + additional_bindings { get: "/v2/{parent=billingAccounts/*}/exclusions" } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the description of an exclusion in the _Default sink. + rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + get: "/v2/{name=*/*/exclusions/*}" + additional_bindings { get: "/v2/{name=projects/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=organizations/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=folders/*/exclusions/*}" } + additional_bindings { get: "/v2/{name=billingAccounts/*/exclusions/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new exclusion in the _Default sink in a specified parent + // resource. Only log entries belonging to that resource can be excluded. You + // can have up to 10 exclusions in a resource. + rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + post: "/v2/{parent=*/*}/exclusions" + body: "exclusion" + additional_bindings { + post: "/v2/{parent=projects/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=organizations/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=folders/*}/exclusions" + body: "exclusion" + } + additional_bindings { + post: "/v2/{parent=billingAccounts/*}/exclusions" + body: "exclusion" + } + }; + option (google.api.method_signature) = "parent,exclusion"; + } + + // Changes one or more properties of an existing exclusion in the _Default + // sink. + rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { + patch: "/v2/{name=*/*/exclusions/*}" + body: "exclusion" + additional_bindings { + patch: "/v2/{name=projects/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=organizations/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=folders/*/exclusions/*}" + body: "exclusion" + } + additional_bindings { + patch: "/v2/{name=billingAccounts/*/exclusions/*}" + body: "exclusion" + } + }; + option (google.api.method_signature) = "name,exclusion,update_mask"; + } + + // Deletes an exclusion in the _Default sink. + rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=*/*/exclusions/*}" + additional_bindings { delete: "/v2/{name=projects/*/exclusions/*}" } + additional_bindings { delete: "/v2/{name=organizations/*/exclusions/*}" } + additional_bindings { delete: "/v2/{name=folders/*/exclusions/*}" } + additional_bindings { + delete: "/v2/{name=billingAccounts/*/exclusions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Gets the Logging CMEK settings for the given resource. + // + // Note: CMEK for the Log Router can be configured for Google Cloud projects, + // folders, organizations and billing accounts. Once configured for an + // organization, it applies to all projects and folders in the Google Cloud + // organization. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { + option (google.api.http) = { + get: "/v2/{name=*/*}/cmekSettings" + additional_bindings { get: "/v2/{name=projects/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=organizations/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=folders/*}/cmekSettings" } + additional_bindings { get: "/v2/{name=billingAccounts/*}/cmekSettings" } + }; + } + + // Updates the Log Router CMEK settings for the given resource. + // + // Note: CMEK for the Log Router can currently only be configured for Google + // Cloud organizations. Once configured, it applies to all projects and + // folders in the Google Cloud organization. + // + // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] + // will fail if 1) `kms_key_name` is invalid, or 2) the associated service + // account does not have the required + // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + // 3) access to the key is disabled. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { + option (google.api.http) = { + patch: "/v2/{name=*/*}/cmekSettings" + body: "cmek_settings" + additional_bindings { + patch: "/v2/{name=organizations/*}/cmekSettings" + body: "cmek_settings" + } + }; + } + + // Gets the Log Router settings for the given resource. + // + // Note: Settings for the Log Router can be get for Google Cloud projects, + // folders, organizations and billing accounts. Currently it can only be + // configured for organizations. Once configured for an organization, it + // applies to all projects and folders in the Google Cloud organization. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc GetSettings(GetSettingsRequest) returns (Settings) { + option (google.api.http) = { + get: "/v2/{name=*/*}/settings" + additional_bindings { get: "/v2/{name=projects/*}/settings" } + additional_bindings { get: "/v2/{name=organizations/*}/settings" } + additional_bindings { get: "/v2/{name=folders/*}/settings" } + additional_bindings { get: "/v2/{name=billingAccounts/*}/settings" } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the Log Router settings for the given resource. + // + // Note: Settings for the Log Router can currently only be configured for + // Google Cloud organizations. Once configured, it applies to all projects and + // folders in the Google Cloud organization. + // + // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] + // will fail if 1) `kms_key_name` is invalid, or 2) the associated service + // account does not have the required + // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + // 3) access to the key is disabled. 4) `location_id` is not supported by + // Logging. 5) `location_id` violate OrgPolicy. + // + // See [Enabling CMEK for Log + // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + // for more information. + rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { + option (google.api.http) = { + patch: "/v2/{name=*/*}/settings" + body: "settings" + additional_bindings { + patch: "/v2/{name=organizations/*}/settings" + body: "settings" + } + additional_bindings { + patch: "/v2/{name=folders/*}/settings" + body: "settings" + } + }; + option (google.api.method_signature) = "settings,update_mask"; + } + + // Copies a set of log entries from a log bucket to a Cloud Storage bucket. + rpc CopyLogEntries(CopyLogEntriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/entries:copy" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "CopyLogEntriesResponse" + metadata_type: "CopyLogEntriesMetadata" + }; + } +} + +// Configuration for an indexed field. +message IndexConfig { + // Required. The LogEntry field path to index. + // + // Note that some paths are automatically indexed, and other paths are not + // eligible for indexing. See [indexing documentation]( + // https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields) + // for details. + // + // For example: `jsonPayload.request.status` + string field_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of data in this index. + IndexType type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The timestamp when the index was last modified. + // + // This is used to return the timestamp, and will be ignored if supplied + // during update. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a repository in which log entries are stored. +message LogBucket { + option (google.api.resource) = { + type: "logging.googleapis.com/LogBucket" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" + }; + + // Output only. The resource name of the bucket. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket` + // + // For a list of supported locations, see [Supported + // Regions](https://cloud.google.com/logging/docs/region-support) + // + // For the location of `global` it is unspecified where log entries are + // actually stored. + // + // After a bucket has been created, the location cannot be changed. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Describes this bucket. + string description = 3; + + // Output only. The creation timestamp of the bucket. This is not set for any + // of the default buckets. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the bucket. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Logs will be retained by default for this amount of time, after which they + // will automatically be deleted. The minimum retention period is 1 day. If + // this value is set to zero at bucket creation time, the default time of 30 + // days will be used. + int32 retention_days = 11; + + // Whether the bucket is locked. + // + // The retention period on a locked bucket cannot be changed. Locked buckets + // may only be deleted if they are empty. + bool locked = 9; + + // Output only. The bucket lifecycle state. + LifecycleState lifecycle_state = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether log analytics is enabled for this bucket. + // + // Once enabled, log analytics features cannot be disabled. + bool analytics_enabled = 14; + + // Log entry field paths that are denied access in this bucket. + // + // The following fields and their children are eligible: `textPayload`, + // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. + // + // Restricting a repeated field will restrict all values. Adding a parent will + // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) + repeated string restricted_fields = 15; + + // A list of indexed fields and related configuration data. + repeated IndexConfig index_configs = 17; + + // The CMEK settings of the log bucket. If present, new log entries written to + // this log bucket are encrypted using the CMEK key provided in this + // configuration. If a log bucket has CMEK settings, the CMEK settings cannot + // be disabled later by updating the log bucket. Changing the KMS key is + // allowed. + CmekSettings cmek_settings = 19; +} + +// Describes a view over log entries in a bucket. +message LogView { + option (google.api.resource) = { + type: "logging.googleapis.com/LogView" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" + }; + + // The resource name of the view. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` + string name = 1; + + // Describes this view. + string description = 3; + + // Output only. The creation timestamp of the view. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the view. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Filter that restricts which log entries in a bucket are visible in this + // view. + // + // Filters are restricted to be a logical AND of ==/!= of any of the + // following: + // + // - originating project/folder/organization/billing account. + // - resource type + // - log id + // + // For example: + // + // SOURCE("projects/myproject") AND resource.type = "gce_instance" + // AND LOG_ID("stdout") + string filter = 7; +} + +// Describes a sink used to export log entries to one of the following +// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a +// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log +// entries are exported. The sink must be created within a project, +// organization, billing account, or folder. +message LogSink { + option (google.api.resource) = { + type: "logging.googleapis.com/LogSink" + pattern: "projects/{project}/sinks/{sink}" + pattern: "organizations/{organization}/sinks/{sink}" + pattern: "folders/{folder}/sinks/{sink}" + pattern: "billingAccounts/{billing_account}/sinks/{sink}" + }; + + // Deprecated. This is unused. + enum VersionFormat { + // An unspecified format version that will default to V2. + VERSION_FORMAT_UNSPECIFIED = 0; + + // `LogEntry` version 2 format. + V2 = 1; + + // `LogEntry` version 1 format. + V1 = 2; + } + + // Required. The client-assigned sink identifier, unique within the project. + // + // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited + // to 100 characters and can include only the following characters: upper and + // lower-case alphanumeric characters, underscores, hyphens, and periods. + // First character has to be alphanumeric. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The export destination: + // + // "storage.googleapis.com/[GCS_BUCKET]" + // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" + // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" + // + // The sink's `writer_identity`, set when the sink is created, must have + // permission to write to the destination or else the log entries are not + // exported. For more information, see + // [Exporting Logs with + // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + string destination = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Optional. An [advanced logs + // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The + // only exported log entries are those that are in the resource owning the + // sink and that match the filter. + // + // For example: + // + // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A description of this sink. + // + // The maximum length of the description is 8000 characters. + string description = 18 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, then this sink is disabled and it does not export + // any log entries. + bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Log entries that match any of these exclusion filters will not be + // exported. + // + // If a log entry is matched by both `filter` and one of `exclusion_filters` + // it will not be exported. + repeated LogExclusion exclusions = 16 + [(google.api.field_behavior) = OPTIONAL]; + + // Deprecated. This field is unused. + VersionFormat output_version_format = 6 [deprecated = true]; + + // Output only. An IAM identity—a service account or group—under + // which Cloud Logging writes the exported log entries to the sink's + // destination. This field is either set by specifying + // `custom_writer_identity` or set automatically by + // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and + // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the + // value of `unique_writer_identity` in those methods. + // + // Until you grant this identity write-access to the destination, log entry + // exports from this sink will fail. For more information, see [Granting + // Access for a + // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). + // Consult the destination service's documentation to determine the + // appropriate IAM roles to assign to the identity. + // + // Sinks that have a destination that is a log bucket in the same project as + // the sink cannot have a writer_identity and no additional permissions are + // required. + string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. This field applies only to sinks owned by organizations and + // folders. If the field is false, the default, only the logs owned by the + // sink's parent resource are available for export. If the field is true, then + // log entries from all the projects, folders, and billing accounts contained + // in the sink's parent resource are also available for export. Whether a + // particular log entry from the children is exported depends on the sink's + // filter expression. + // + // For example, if this field is true, then the filter + // `resource.type=gce_instance` would export all Compute Engine VM instance + // log entries from all projects in the sink's parent. + // + // To only export entries from certain child projects, filter on the project + // part of the log name: + // + // logName:("projects/test-project1/" OR "projects/test-project2/") AND + // resource.type=gce_instance + bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Destination dependent options. + oneof options { + // Optional. Options that affect sinks exporting data to BigQuery. + BigQueryOptions bigquery_options = 12 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The creation timestamp of the sink. + // + // This field may not be present for older sinks. + google.protobuf.Timestamp create_time = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the sink. + // + // This field may not be present for older sinks. + google.protobuf.Timestamp update_time = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a BigQuery dataset that was created by a link. +message BigQueryDataset { + // Output only. The full resource name of the BigQuery dataset. The DATASET_ID + // will match the ID of the link, so the link must match the naming + // restrictions of BigQuery datasets (alphanumeric characters and underscores + // only). + // + // The dataset will have a resource path of + // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]" + string dataset_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes a link connected to an analytics enabled bucket. +message Link { + option (google.api.resource) = { + type: "logging.googleapis.com/Link" + pattern: "projects/{project}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}" + pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}" + }; + + // The resource name of the link. The name can have up to 100 characters. + // A valid link id (at the end of the link name) must only have alphanumeric + // characters and underscores within it. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket/links/my_link + string name = 1; + + // Describes this link. + // + // The maximum length of the description is 8000 characters. + string description = 2; + + // Output only. The creation timestamp of the link. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The resource lifecycle state. + LifecycleState lifecycle_state = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The information of a BigQuery Dataset. When a link is created, a BigQuery + // dataset is created along with it, in the same project as the LogBucket it's + // linked to. This dataset will also have BigQuery Views corresponding to the + // LogViews in the bucket. + BigQueryDataset bigquery_dataset = 5; +} + +// Options that change functionality of a sink exporting data to BigQuery. +message BigQueryOptions { + // Optional. Whether to use [BigQuery's partition + // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By + // default, Cloud Logging creates dated tables based on the log entries' + // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix + // is no longer present and [special query + // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) + // has to be used instead. In both cases, tables are sharded based on UTC + // timezone. + bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. True if new timestamp column based partitioning is in use, + // false if legacy ingestion-time partitioning is in use. + // + // All new sinks will have this field set true and will use timestamp column + // based partitioning. If use_partitioned_tables is false, this value has no + // meaning and will be false. Legacy sinks using partitioned tables will have + // this field set to false. + bool uses_timestamp_column_partitioning = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The parameters to `ListBuckets`. +message ListBucketsRequest { + // Required. The parent resource whose buckets are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + // + // Note: The locations portion of the resource must be specified, but + // supplying the character `-` in place of [LOCATION_ID] will return all + // buckets. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogBucket" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListBuckets. +message ListBucketsResponse { + // A list of buckets. + repeated LogBucket buckets = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `CreateBucket`. +message CreateBucketRequest { + // Required. The resource in which to create the log bucket: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + // + // For example: + // + // `"projects/my-project/locations/global"` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogBucket" + } + ]; + + // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + // are limited to 100 characters and can include only letters, digits, + // underscores, hyphens, and periods. + string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new bucket. The region specified in the new bucket must be + // compliant with any Location Restriction Org Policy. The name field in the + // bucket is ignored. + LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `UpdateBucket`. +message UpdateBucketRequest { + // Required. The full resource name of the bucket to update. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; + + // Required. The updated bucket. + LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask that specifies the fields in `bucket` that need an + // update. A bucket field will be overwritten if, and only if, it is in the + // update mask. `name` and output only fields cannot be updated. + // + // For a detailed `FieldMask` definition, see: + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=retention_days` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `GetBucket`. +message GetBucketRequest { + // Required. The resource name of the bucket: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `DeleteBucket`. +message DeleteBucketRequest { + // Required. The full resource name of the bucket to delete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `UndeleteBucket`. +message UndeleteBucketRequest { + // Required. The full resource name of the bucket to undelete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogBucket" + } + ]; +} + +// The parameters to `ListViews`. +message ListViewsRequest { + // Required. The bucket whose views are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListViews. +message ListViewsResponse { + // A list of views. + repeated LogView views = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `CreateView`. +message CreateViewRequest { + // Required. The bucket in which to create the view + // + // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket"` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A client-assigned identifier such as `"my-view"`. Identifiers are + // limited to 100 characters and can include only letters, digits, + // underscores, hyphens, and periods. + string view_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new view. + LogView view = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to `UpdateView`. +message UpdateViewRequest { + // Required. The full resource name of the view to update + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The updated view. + LogView view = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Field mask that specifies the fields in `view` that need + // an update. A field will be overwritten if, and only if, it is + // in the update mask. `name` and output only fields cannot be updated. + // + // For a detailed `FieldMask` definition, see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=filter` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `GetView`. +message GetViewRequest { + // Required. The resource name of the policy: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } + ]; +} + +// The parameters to `DeleteView`. +message DeleteViewRequest { + // Required. The full resource name of the view to delete: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + // + // For example: + // + // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } + ]; +} + +// The parameters to `ListSinks`. +message ListSinksRequest { + // Required. The parent resource whose sinks are to be listed: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogSink" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from `ListSinks`. +message ListSinksResponse { + // A list of sinks. + repeated LogSink sinks = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `GetSink`. +message GetSinkRequest { + // Required. The resource name of the sink: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; +} + +// The parameters to `CreateSink`. +message CreateSinkRequest { + // Required. The resource in which to create the sink: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + // + // For examples: + // + // `"projects/my-project"` + // `"organizations/123456789"` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogSink" + } + ]; + + // Required. The new sink, whose `name` parameter is a sink identifier that + // is not already in use. + LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Determines the kind of IAM identity returned as `writer_identity` + // in the new sink. If this value is omitted or set to false, and if the + // sink's parent is a project, then the value returned as `writer_identity` is + // the same group or service account used by Cloud Logging before the addition + // of writer identities to this API. The sink's destination must be in the + // same project as the sink itself. + // + // If this field is set to true, or if the sink is owned by a non-project + // resource such as an organization, then the value of `writer_identity` will + // be a unique service account used only for exports from the new sink. For + // more information, see `writer_identity` in + // [LogSink][google.logging.v2.LogSink]. + bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `UpdateSink`. +message UpdateSinkRequest { + // Required. The full resource name of the sink to update, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; + + // Required. The updated sink, whose name is the same identifier that appears + // as part of `sink_name`. + LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] + // for a description of this field. When updating a sink, the effect of this + // field on the value of `writer_identity` in the updated sink depends on both + // the old and new values of this field: + // + // + If the old and new values of this field are both false or both true, + // then there is no change to the sink's `writer_identity`. + // + If the old value is false and the new value is true, then + // `writer_identity` is changed to a unique service account. + // + It is an error if the old value is true and the new value is + // set to false or defaulted to false. + bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Field mask that specifies the fields in `sink` that need + // an update. A sink field will be overwritten if, and only if, it is + // in the update mask. `name` and output only fields cannot be updated. + // + // An empty `updateMask` is temporarily treated as using the following mask + // for backwards compatibility purposes: + // + // `destination,filter,includeChildren` + // + // At some point in the future, behavior will be removed and specifying an + // empty `updateMask` will be an error. + // + // For a detailed `FieldMask` definition, see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + // + // For example: `updateMask=filter` + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The parameters to `DeleteSink`. +message DeleteSinkRequest { + // Required. The full resource name of the sink to delete, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // For example: + // + // `"projects/my-project/sinks/my-sink"` + string sink_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } + ]; +} + +// The parameters to CreateLink. +message CreateLinkRequest { + // Required. The full resource name of the bucket to create a link for. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Link" + } + ]; + + // Required. The new link. + Link link = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the link. The link_id can have up to 100 + // characters. A valid link_id must only have alphanumeric characters and + // underscores within it. + string link_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to DeleteLink. +message DeleteLinkRequest { + // Required. The full resource name of the link to delete. + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } + ]; +} + +// The parameters to ListLinks. +message ListLinksRequest { + // Required. The parent resource whose links are to be listed: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/Link" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from ListLinks. +message ListLinksResponse { + // A list of links. + repeated Link links = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to GetLink. +message GetLinkRequest { + // Required. The resource name of the link: + // + // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } + ]; +} + +// Specifies a set of log entries that are filtered out by a sink. If +// your Google Cloud resource receives a large volume of log entries, you can +// use exclusions to reduce your chargeable logs. Note that exclusions on +// organization-level and folder-level sinks don't apply to child resources. +// Note also that you cannot modify the _Required sink or exclude logs from it. +message LogExclusion { + option (google.api.resource) = { + type: "logging.googleapis.com/LogExclusion" + pattern: "projects/{project}/exclusions/{exclusion}" + pattern: "organizations/{organization}/exclusions/{exclusion}" + pattern: "folders/{folder}/exclusions/{exclusion}" + pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" + }; + + // Required. A client-assigned identifier, such as + // `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and + // can include only letters, digits, underscores, hyphens, and periods. First + // character has to be alphanumeric. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A description of this exclusion. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. An [advanced logs + // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that + // matches the log entries to be excluded. By using the [sample + // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), + // you can exclude less than 100% of the matching log entries. + // + // For example, the following query matches 99% of low-severity log entries + // from Google Cloud Storage buckets: + // + // `resource.type=gcs_bucket severity=ERROR" + // + // The maximum length of the filter is 20000 characters. + string filter = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The resource name of the Log Bucket that owns the Log Metric. + // Only Log Buckets in projects are supported. The bucket has to be in the + // same project as the metric. + // + // For example: + // + // `projects/my-project/locations/global/buckets/my-bucket` + // + // If empty, then the Log Metric is considered a non-Bucket Log Metric. + string bucket_name = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to True, then this metric is disabled and it does not + // generate any points. + bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The metric descriptor associated with the logs-based metric. + // If unspecified, it uses a default metric descriptor with a DELTA metric + // kind, INT64 value type, with no labels and a unit of "1". Such a metric + // counts the number of log entries matching the `filter` expression. + // + // The `name`, `type`, and `description` fields in the `metric_descriptor` + // are output only, and is constructed using the `name` and `description` + // field in the LogMetric. + // + // To create a logs-based metric that records a distribution of log values, a + // DELTA metric kind with a DISTRIBUTION value type must be used along with + // a `value_extractor` expression in the LogMetric. + // + // Each label in the metric descriptor must have a matching label + // name as the key and an extractor expression as the value in the + // `label_extractors` map. + // + // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot + // be updated once initially configured. New labels can be added in the + // `metric_descriptor`, but existing labels cannot be modified except for + // their description. + google.api.MetricDescriptor metric_descriptor = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A `value_extractor` is required when using a distribution + // logs-based metric to extract the values to record from a log entry. + // Two functions are supported for value extraction: `EXTRACT(field)` or + // `REGEXP_EXTRACT(field, regex)`. The arguments are: + // + // 1. field: The name of the log entry field from which the value is to be + // extracted. + // 2. regex: A regular expression using the Google RE2 syntax + // (https://github.com/google/re2/wiki/Syntax) with a single capture + // group to extract data from the specified log entry field. The value + // of the field is converted to a string before applying the regex. + // It is an error to specify a regex that does not include exactly one + // capture group. + // + // The result of the extraction must be convertible to a double type, as the + // distribution always records double values. If either the extraction or + // the conversion to double fails, then those values are not recorded in the + // distribution. + // + // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` + string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A map from a label key string to an extractor expression which is + // used to extract data from a log entry field and assign as the label value. + // Each label key specified in the LabelDescriptor must have an associated + // extractor expression in this map. The syntax of the extractor expression + // is the same as for the `value_extractor` field. + // + // The extracted value is converted to the type defined in the label + // descriptor. If either the extraction or the type conversion fails, + // the label will have a default value. The default value for a string + // label is an empty string, for an integer label its 0, and for a boolean + // label its `false`. + // + // Note that there are upper bounds on the maximum number of labels and the + // number of active time series that are allowed in a project. + map label_extractors = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `bucket_options` are required when the logs-based metric is + // using a DISTRIBUTION value type and it describes the bucket boundaries + // used to create a histogram of the extracted values. + google.api.Distribution.BucketOptions bucket_options = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The creation timestamp of the metric. + // + // This field may not be present for older metrics. + google.protobuf.Timestamp create_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the metric. + // + // This field may not be present for older metrics. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Deprecated. The API version that created or updated this metric. + // The v2 format is used by default and cannot be changed. + ApiVersion version = 4 [deprecated = true]; +} + +// The parameters to ListLogMetrics. +message ListLogMetricsRequest { + // Required. The name of the project containing the metrics: + // + // "projects/[PROJECT_ID]" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Result returned from ListLogMetrics. +message ListLogMetricsResponse { + // A list of logs-based metrics. + repeated LogMetric metrics = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to GetLogMetric. +message GetLogMetricRequest { + // Required. The resource name of the desired metric: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; +} + +// The parameters to CreateLogMetric. +message CreateLogMetricRequest { + // Required. The resource name of the project in which to create the metric: + // + // "projects/[PROJECT_ID]" + // + // The new metric must be provided in the request. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "logging.googleapis.com/LogMetric" + } + ]; + + // Required. The new logs-based metric, which must not have an identifier that + // already exists. + LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to UpdateLogMetric. +message UpdateLogMetricRequest { + // Required. The resource name of the metric to update: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + // + // The updated metric must be provided in the request and it's + // `name` field must be the same as `[METRIC_ID]` If the metric + // does not exist in `[PROJECT_ID]`, then a new metric is created. + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; + + // Required. The updated metric. + LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The parameters to DeleteLogMetric. +message DeleteLogMetricRequest { + // Required. The resource name of the metric to delete: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "logging.googleapis.com/LogMetric" + } + ]; +} diff --git a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js new file mode 100644 index 00000000..23bfc32a --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, destination) { + // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Log bucket from which to copy log entries. + * For example: + * `"projects/my-project/locations/global/buckets/my-source-bucket"` + */ + // const name = 'abc123' + /** + * Optional. A filter specifying which log entries to copy. The filter must be + * no more than 20k characters. An empty filter matches all log entries. + */ + // const filter = 'abc123' + /** + * Required. Destination to which to copy log entries. + */ + // const destination = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCopyLogEntries() { + // Construct request + const request = { + name, + destination, + }; + + // Run request + const [operation] = await loggingClient.copyLogEntries(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCopyLogEntries(); + // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_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/config_service_v2.create_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js new file mode 100644 index 00000000..1de575fc --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bucketId, bucket) { + // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the log bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * For example: + * `"projects/my-project/locations/global"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const bucketId = 'abc123' + /** + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + */ + // const bucket = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateBucket() { + // Construct request + const request = { + parent, + bucketId, + bucket, + }; + + // Run request + const response = await loggingClient.createBucket(request); + console.log(response); + } + + callCreateBucket(); + // [END logging_v2_generated_ConfigServiceV2_CreateBucket_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/config_service_v2.create_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js new file mode 100644 index 00000000..864ee229 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js @@ -0,0 +1,79 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bucketId, bucket) { + // [START logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the log bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * For example: + * `"projects/my-project/locations/global"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const bucketId = 'abc123' + /** + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + */ + // const bucket = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateBucketAsync() { + // Construct request + const request = { + parent, + bucketId, + bucket, + }; + + // Run request + const [operation] = await loggingClient.createBucketAsync(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBucketAsync(); + // [END logging_v2_generated_ConfigServiceV2_CreateBucketAsync_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/config_service_v2.create_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js new file mode 100644 index 00000000..e2fa1898 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, exclusion) { + // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource in which to create the exclusion: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * For examples: + * `"projects/my-logging-project"` + * `"organizations/123456789"` + */ + // const parent = 'abc123' + /** + * Required. The new exclusion, whose `name` parameter is an exclusion name + * that is not already used in the parent resource. + */ + // const exclusion = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateExclusion() { + // Construct request + const request = { + parent, + exclusion, + }; + + // Run request + const response = await loggingClient.createExclusion(request); + console.log(response); + } + + callCreateExclusion(); + // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_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/config_service_v2.create_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js new file mode 100644 index 00000000..56e3e2ad --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, link, linkId) { + // [START logging_v2_generated_ConfigServiceV2_CreateLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to create a link for. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + */ + // const parent = 'abc123' + /** + * Required. The new link. + */ + // const link = {} + /** + * Required. The ID to use for the link. The link_id can have up to 100 + * characters. A valid link_id must only have alphanumeric characters and + * underscores within it. + */ + // const linkId = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateLink() { + // Construct request + const request = { + parent, + link, + linkId, + }; + + // Run request + const [operation] = await loggingClient.createLink(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateLink(); + // [END logging_v2_generated_ConfigServiceV2_CreateLink_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/config_service_v2.create_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js new file mode 100644 index 00000000..46f64094 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js @@ -0,0 +1,88 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, sink) { + // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource in which to create the sink: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * For examples: + * `"projects/my-project"` + * `"organizations/123456789"` + */ + // const parent = 'abc123' + /** + * Required. The new sink, whose `name` parameter is a sink identifier that + * is not already in use. + */ + // const sink = {} + /** + * Optional. Determines the kind of IAM identity returned as `writer_identity` + * in the new sink. If this value is omitted or set to false, and if the + * sink's parent is a project, then the value returned as `writer_identity` is + * the same group or service account used by Cloud Logging before the addition + * of writer identities to this API. The sink's destination must be in the + * same project as the sink itself. + * If this field is set to true, or if the sink is owned by a non-project + * resource such as an organization, then the value of `writer_identity` will + * be a unique service account used only for exports from the new sink. For + * more information, see `writer_identity` in + * LogSink google.logging.v2.LogSink. + */ + // const uniqueWriterIdentity = true + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateSink() { + // Construct request + const request = { + parent, + sink, + }; + + // Run request + const response = await loggingClient.createSink(request); + console.log(response); + } + + callCreateSink(); + // [END logging_v2_generated_ConfigServiceV2_CreateSink_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/config_service_v2.create_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js new file mode 100644 index 00000000..1d598493 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, viewId, view) { + // [START logging_v2_generated_ConfigServiceV2_CreateView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The bucket in which to create the view + * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const parent = 'abc123' + /** + * Required. A client-assigned identifier such as `"my-view"`. Identifiers are + * limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + */ + // const viewId = 'abc123' + /** + * Required. The new view. + */ + // const view = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callCreateView() { + // Construct request + const request = { + parent, + viewId, + view, + }; + + // Run request + const response = await loggingClient.createView(request); + console.log(response); + } + + callCreateView(); + // [END logging_v2_generated_ConfigServiceV2_CreateView_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/config_service_v2.delete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js new file mode 100644 index 00000000..368c926b --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to delete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteBucket(request); + console.log(response); + } + + callDeleteBucket(); + // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_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/config_service_v2.delete_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js new file mode 100644 index 00000000..bf359314 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of an existing exclusion to delete: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteExclusion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteExclusion(request); + console.log(response); + } + + callDeleteExclusion(); + // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_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/config_service_v2.delete_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js new file mode 100644 index 00000000..6a714386 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js @@ -0,0 +1,66 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the link to delete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteLink() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await loggingClient.deleteLink(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteLink(); + // [END logging_v2_generated_ConfigServiceV2_DeleteLink_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/config_service_v2.delete_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js new file mode 100644 index 00000000..0d90840d --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js @@ -0,0 +1,68 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName) { + // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the sink to delete, including the + * parent resource and the sink identifier: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteSink() { + // Construct request + const request = { + sinkName, + }; + + // Run request + const response = await loggingClient.deleteSink(request); + console.log(response); + } + + callDeleteSink(); + // [END logging_v2_generated_ConfigServiceV2_DeleteSink_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/config_service_v2.delete_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js new file mode 100644 index 00000000..92ef8caf --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js @@ -0,0 +1,64 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the view to delete: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callDeleteView() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.deleteView(request); + console.log(response); + } + + callDeleteView(); + // [END logging_v2_generated_ConfigServiceV2_DeleteView_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/config_service_v2.get_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js new file mode 100644 index 00000000..0f9a7811 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the bucket: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getBucket(request); + console.log(response); + } + + callGetBucket(); + // [END logging_v2_generated_ConfigServiceV2_GetBucket_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/config_service_v2.get_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js new file mode 100644 index 00000000..1256b615 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource for which to retrieve CMEK settings. + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * For example: + * `"organizations/12345/cmekSettings"` + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetCmekSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getCmekSettings(request); + console.log(response); + } + + callGetCmekSettings(); + // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_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/config_service_v2.get_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js new file mode 100644 index 00000000..a9459c99 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of an existing exclusion: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetExclusion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getExclusion(request); + console.log(response); + } + + callGetExclusion(); + // [END logging_v2_generated_ConfigServiceV2_GetExclusion_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/config_service_v2.get_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js new file mode 100644 index 00000000..d95999ae --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js @@ -0,0 +1,65 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetLink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the link: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetLink() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getLink(request); + console.log(response); + } + + callGetLink(); + // [END logging_v2_generated_ConfigServiceV2_GetLink_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/config_service_v2.get_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js new file mode 100644 index 00000000..99df9924 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource for which to retrieve settings. + * "projects/[PROJECT_ID]/settings" + * "organizations/[ORGANIZATION_ID]/settings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" + * "folders/[FOLDER_ID]/settings" + * For example: + * `"organizations/12345/settings"` + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getSettings(request); + console.log(response); + } + + callGetSettings(); + // [END logging_v2_generated_ConfigServiceV2_GetSettings_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/config_service_v2.get_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js new file mode 100644 index 00000000..21e331ee --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName) { + // [START logging_v2_generated_ConfigServiceV2_GetSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the sink: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetSink() { + // Construct request + const request = { + sinkName, + }; + + // Run request + const response = await loggingClient.getSink(request); + console.log(response); + } + + callGetSink(); + // [END logging_v2_generated_ConfigServiceV2_GetSink_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/config_service_v2.get_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js new file mode 100644 index 00000000..d487ce10 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js @@ -0,0 +1,64 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_GetView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the policy: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callGetView() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.getView(request); + console.log(response); + } + + callGetView(); + // [END logging_v2_generated_ConfigServiceV2_GetView_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/config_service_v2.list_buckets.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js new file mode 100644 index 00000000..48c9e415 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose buckets are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of LOCATION_ID will return all + * buckets. + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListBuckets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listBucketsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuckets(); + // [END logging_v2_generated_ConfigServiceV2_ListBuckets_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/config_service_v2.list_exclusions.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js new file mode 100644 index 00000000..888d53fd --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose exclusions are to be listed. + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListExclusions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listExclusionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExclusions(); + // [END logging_v2_generated_ConfigServiceV2_ListExclusions_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/config_service_v2.list_links.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js new file mode 100644 index 00000000..fa5ac843 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListLinks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose links are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListLinks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLinksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLinks(); + // [END logging_v2_generated_ConfigServiceV2_ListLinks_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/config_service_v2.list_sinks.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js new file mode 100644 index 00000000..85486c8c --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource whose sinks are to be listed: + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListSinks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listSinksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSinks(); + // [END logging_v2_generated_ConfigServiceV2_ListSinks_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/config_service_v2.list_views.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js new file mode 100644 index 00000000..815ee322 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_ConfigServiceV2_ListViews_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The bucket whose views are to be listed: + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callListViews() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listViewsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListViews(); + // [END logging_v2_generated_ConfigServiceV2_ListViews_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/config_service_v2.undelete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js new file mode 100644 index 00000000..da866082 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to undelete. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUndeleteBucket() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await loggingClient.undeleteBucket(request); + console.log(response); + } + + callUndeleteBucket(); + // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_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/config_service_v2.update_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js new file mode 100644 index 00000000..9c98e2d3 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js @@ -0,0 +1,82 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, bucket, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to update. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + /** + * Required. The updated bucket. + */ + // const bucket = {} + /** + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=retention_days` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateBucket() { + // Construct request + const request = { + name, + bucket, + updateMask, + }; + + // Run request + const response = await loggingClient.updateBucket(request); + console.log(response); + } + + callUpdateBucket(); + // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_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/config_service_v2.update_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js new file mode 100644 index 00000000..a06c31cc --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, bucket, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the bucket to update. + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket"` + */ + // const name = 'abc123' + /** + * Required. The updated bucket. + */ + // const bucket = {} + /** + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=retention_days` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateBucketAsync() { + // Construct request + const request = { + name, + bucket, + updateMask, + }; + + // Run request + const [operation] = await loggingClient.updateBucketAsync(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBucketAsync(); + // [END logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_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/config_service_v2.update_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js new file mode 100644 index 00000000..09012657 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, cmekSettings) { + // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the CMEK settings to update. + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * For example: + * `"organizations/12345/cmekSettings"` + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + */ + // const name = 'abc123' + /** + * Required. The CMEK settings to update. + * See Enabling CMEK for Log + * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + */ + // const cmekSettings = {} + /** + * Optional. Field mask identifying which fields from `cmek_settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * See FieldMask google.protobuf.FieldMask for more information. + * For example: `"updateMask=kmsKeyName"` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateCmekSettings() { + // Construct request + const request = { + name, + cmekSettings, + }; + + // Run request + const response = await loggingClient.updateCmekSettings(request); + console.log(response); + } + + callUpdateCmekSettings(); + // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_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/config_service_v2.update_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js new file mode 100644 index 00000000..11cc66d5 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, exclusion, updateMask) { + // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the exclusion to update: + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * For example: + * `"projects/my-project/exclusions/my-exclusion"` + */ + // const name = 'abc123' + /** + * Required. New values for the existing exclusion. Only the fields specified + * in `update_mask` are relevant. + */ + // const exclusion = {} + /** + * Required. A non-empty list of fields to change in the existing exclusion. + * New values for the fields are taken from the corresponding fields in the + * LogExclusion google.logging.v2.LogExclusion included in this request. + * Fields not mentioned in `update_mask` are not changed and are ignored in + * the request. + * For example, to change the filter and description of an exclusion, + * specify an `update_mask` of `"filter,description"`. + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateExclusion() { + // Construct request + const request = { + name, + exclusion, + updateMask, + }; + + // Run request + const response = await loggingClient.updateExclusion(request); + console.log(response); + } + + callUpdateExclusion(); + // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_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/config_service_v2.update_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js new file mode 100644 index 00000000..35ebd66f --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js @@ -0,0 +1,83 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, settings) { + // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the settings to update. + * "organizations/[ORGANIZATION_ID]/settings" + * For example: + * `"organizations/12345/settings"` + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + */ + // const name = 'abc123' + /** + * Required. The settings to update. + * See Enabling CMEK for Log + * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + */ + // const settings = {} + /** + * Optional. Field mask identifying which fields from `settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * See FieldMask google.protobuf.FieldMask for more information. + * For example: `"updateMask=kmsKeyName"` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateSettings() { + // Construct request + const request = { + name, + settings, + }; + + // Run request + const response = await loggingClient.updateSettings(request); + console.log(response); + } + + callUpdateSettings(); + // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_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/config_service_v2.update_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js new file mode 100644 index 00000000..7fd08496 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js @@ -0,0 +1,101 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(sinkName, sink) { + // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the sink to update, including the + * parent resource and the sink identifier: + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * For example: + * `"projects/my-project/sinks/my-sink"` + */ + // const sinkName = 'abc123' + /** + * Required. The updated sink, whose name is the same identifier that appears + * as part of `sink_name`. + */ + // const sink = {} + /** + * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink + * for a description of this field. When updating a sink, the effect of this + * field on the value of `writer_identity` in the updated sink depends on both + * the old and new values of this field: + * + If the old and new values of this field are both false or both true, + * then there is no change to the sink's `writer_identity`. + * + If the old value is false and the new value is true, then + * `writer_identity` is changed to a unique service account. + * + It is an error if the old value is true and the new value is + * set to false or defaulted to false. + */ + // const uniqueWriterIdentity = true + /** + * Optional. Field mask that specifies the fields in `sink` that need + * an update. A sink field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * An empty `updateMask` is temporarily treated as using the following mask + * for backwards compatibility purposes: + * `destination,filter,includeChildren` + * At some point in the future, behavior will be removed and specifying an + * empty `updateMask` will be an error. + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=filter` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateSink() { + // Construct request + const request = { + sinkName, + sink, + }; + + // Run request + const response = await loggingClient.updateSink(request); + console.log(response); + } + + callUpdateSink(); + // [END logging_v2_generated_ConfigServiceV2_UpdateSink_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/config_service_v2.update_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js new file mode 100644 index 00000000..acc6bfb9 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js @@ -0,0 +1,78 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, view) { + // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of the view to update + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * For example: + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + */ + // const name = 'abc123' + /** + * Required. The updated view. + */ + // const view = {} + /** + * Optional. Field mask that specifies the fields in `view` that need + * an update. A field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * For example: `updateMask=filter` + */ + // const updateMask = {} + + // Imports the Logging library + const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new ConfigServiceV2Client(); + + async function callUpdateView() { + // Construct request + const request = { + name, + view, + }; + + // Run request + const response = await loggingClient.updateView(request); + console.log(response); + } + + callUpdateView(); + // [END logging_v2_generated_ConfigServiceV2_UpdateView_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/logging_service_v2.delete_log.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js new file mode 100644 index 00000000..c8b817e7 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js @@ -0,0 +1,70 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(logName) { + // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the log to delete: + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * `[LOG_ID]` must be URL-encoded. For example, + * `"projects/my-project-id/logs/syslog"`, + * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + * For more information about log names, see + * LogEntry google.logging.v2.LogEntry. + */ + // const logName = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callDeleteLog() { + // Construct request + const request = { + logName, + }; + + // Run request + const response = await loggingClient.deleteLog(request); + console.log(response); + } + + callDeleteLog(); + // [END logging_v2_generated_LoggingServiceV2_DeleteLog_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/logging_service_v2.list_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js new file mode 100644 index 00000000..355fcc84 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js @@ -0,0 +1,106 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resourceNames) { + // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * May alternatively be one or more views: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + */ + // const resourceNames = ['abc','def'] + /** + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + */ + // const filter = 'abc123' + /** + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + */ + // const orderBy = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListLogEntries() { + // Construct request + const request = { + resourceNames, + }; + + // Run request + const iterable = await loggingClient.listLogEntriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_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/logging_service_v2.list_logs.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js new file mode 100644 index 00000000..1e8c7caa --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js @@ -0,0 +1,94 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name to list logs for: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + */ + // const parent = 'abc123' + /** + * Optional. List of resource names to list logs for: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * To support legacy queries, it could also be: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * The resource name in the `parent` field is added to this list. + */ + // const resourceNames = ['abc','def'] + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListLogs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLogsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogs(); + // [END logging_v2_generated_LoggingServiceV2_ListLogs_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/logging_service_v2.list_monitored_resource_descriptors.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js new file mode 100644 index 00000000..4552dacd --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callListMonitoredResourceDescriptors() { + // Construct request + const request = { + }; + + // Run request + const iterable = await loggingClient.listMonitoredResourceDescriptorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMonitoredResourceDescriptors(); + // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_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/logging_service_v2.tail_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js new file mode 100644 index 00000000..a0d3eeb7 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js @@ -0,0 +1,89 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resourceNames) { + // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of a parent resource from which to retrieve log entries: + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * May alternatively be one or more views: + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + */ + // const resourceNames = ['abc','def'] + /** + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + */ + // const filter = 'abc123' + /** + * Optional. The amount of time to buffer log entries at the server before + * being returned to prevent out of order results due to late arriving log + * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 + * milliseconds. + */ + // const bufferWindow = {} + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callTailLogEntries() { + // Construct request + const request = { + resourceNames, + }; + + // Run request + const stream = await loggingClient.tailLogEntries(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callTailLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_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/logging_service_v2.write_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js new file mode 100644 index 00000000..888245ae --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js @@ -0,0 +1,129 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(entries) { + // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. A default log resource name that is assigned to all log entries + * in `entries` that do not specify a value for `log_name`: + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * `[LOG_ID]` must be URL-encoded. For example: + * "projects/my-project-id/logs/syslog" + * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + * The permission `logging.logEntries.create` is needed on each project, + * organization, billing account, or folder that is receiving new log + * entries, whether the resource is specified in `logName` or in an + * individual log entry. + */ + // const logName = 'abc123' + /** + * Optional. A default monitored resource object that is assigned to all log + * entries in `entries` that do not specify a value for `resource`. Example: + * { "type": "gce_instance", + * "labels": { + * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + * See LogEntry google.logging.v2.LogEntry. + */ + // const resource = {} + /** + * Optional. Default labels that are added to the `labels` field of all log + * entries in `entries`. If a log entry already has a label with the same key + * as a label in this parameter, then the log entry's label is not changed. + * See LogEntry google.logging.v2.LogEntry. + */ + // const labels = [1,2,3,4] + /** + * Required. The log entries to send to Logging. The order of log + * entries in this list does not matter. Values supplied in this method's + * `log_name`, `resource`, and `labels` fields are copied into those log + * entries in this list that do not include values for their corresponding + * fields. For more information, see the + * LogEntry google.logging.v2.LogEntry type. + * If the `timestamp` or `insert_id` fields are missing in log entries, then + * this method supplies the current time or a unique identifier, respectively. + * The supplied values are chosen so that, among the log entries that did not + * supply their own values, the entries earlier in the list will sort before + * the entries later in the list. See the `entries.list` method. + * Log entries with timestamps that are more than the + * logs retention period (https://cloud.google.com/logging/quotas) in + * the past or more than 24 hours in the future will not be available when + * calling `entries.list`. However, those log entries can still be exported + * with + * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + * To improve throughput and to avoid exceeding the + * quota limit (https://cloud.google.com/logging/quotas) for calls to + * `entries.write`, you should try to include several log entries in this + * list, rather than calling this method for each individual log entry. + */ + // const entries = [1,2,3,4] + /** + * Optional. Whether a batch's valid entries should be written even if some + * other entry failed due to a permanent error such as INVALID_ARGUMENT or + * PERMISSION_DENIED. If any entry failed, then the response status is the + * response status of one of the failed entries. The response will include + * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + * the entries' zero-based index in the `entries`. Failed requests for which + * no entries are written will not include per-entry errors. + */ + // const partialSuccess = true + /** + * Optional. If true, the request should expect normal response, but the + * entries won't be persisted nor exported. Useful for checking whether the + * logging API endpoints are working properly before sending valuable data. + */ + // const dryRun = true + + // Imports the Logging library + const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new LoggingServiceV2Client(); + + async function callWriteLogEntries() { + // Construct request + const request = { + entries, + }; + + // Run request + const response = await loggingClient.writeLogEntries(request); + console.log(response); + } + + callWriteLogEntries(); + // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_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/metrics_service_v2.create_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js new file mode 100644 index 00000000..b48ae935 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js @@ -0,0 +1,69 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, metric) { + // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project in which to create the metric: + * "projects/[PROJECT_ID]" + * The new metric must be provided in the request. + */ + // const parent = 'abc123' + /** + * Required. The new logs-based metric, which must not have an identifier that + * already exists. + */ + // const metric = {} + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callCreateLogMetric() { + // Construct request + const request = { + parent, + metric, + }; + + // Run request + const response = await loggingClient.createLogMetric(request); + console.log(response); + } + + callCreateLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_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/metrics_service_v2.delete_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js new file mode 100644 index 00000000..661e224f --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName) { + // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the metric to delete: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + */ + // const metricName = 'abc123' + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callDeleteLogMetric() { + // Construct request + const request = { + metricName, + }; + + // Run request + const response = await loggingClient.deleteLogMetric(request); + console.log(response); + } + + callDeleteLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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/metrics_service_v2.get_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js new file mode 100644 index 00000000..c8d8b6a0 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName) { + // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the desired metric: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + */ + // const metricName = 'abc123' + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callGetLogMetric() { + // Construct request + const request = { + metricName, + }; + + // Run request + const response = await loggingClient.getLogMetric(request); + console.log(response); + } + + callGetLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_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/metrics_service_v2.list_log_metrics.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js new file mode 100644 index 00000000..558322ef --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js @@ -0,0 +1,77 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project containing the metrics: + * "projects/[PROJECT_ID]" + */ + // const parent = 'abc123' + /** + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + */ + // const pageToken = 'abc123' + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + */ + // const pageSize = 1234 + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callListLogMetrics() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await loggingClient.listLogMetricsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListLogMetrics(); + // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_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/metrics_service_v2.update_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js new file mode 100644 index 00000000..942d8246 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js @@ -0,0 +1,70 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(metricName, metric) { + // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the metric to update: + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * The updated metric must be provided in the request and it's + * `name` field must be the same as `[METRIC_ID]` If the metric + * does not exist in `[PROJECT_ID]`, then a new metric is created. + */ + // const metricName = 'abc123' + /** + * Required. The updated metric. + */ + // const metric = {} + + // Imports the Logging library + const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; + + // Instantiates a client + const loggingClient = new MetricsServiceV2Client(); + + async function callUpdateLogMetric() { + // Construct request + const request = { + metricName, + metric, + }; + + // Run request + const response = await loggingClient.updateLogMetric(request); + console.log(response); + } + + callUpdateLogMetric(); + // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_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.logging.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json new file mode 100644 index 00000000..c6798780 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json @@ -0,0 +1,1963 @@ +{ + "clientLibrary": { + "name": "nodejs-logging", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.logging.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", + "title": "logging listBuckets Sample", + "origin": "API_DEFINITION", + "description": " Lists log buckets.", + "canonical": true, + "file": "config_service_v2.list_buckets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuckets", + "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListBucketsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListBuckets", + "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", + "title": "logging getBucket Sample", + "origin": "API_DEFINITION", + "description": " Gets a log bucket.", + "canonical": true, + "file": "config_service_v2.get_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBucket", + "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetBucket", + "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async", + "title": "logging createBucketAsync Sample", + "origin": "API_DEFINITION", + "description": " Creates a log bucket asynchronously that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.create_bucket_async.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "bucket_id", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async", + "title": "logging updateBucketAsync Sample", + "origin": "API_DEFINITION", + "description": " Updates a log bucket asynchronously. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.update_bucket_async.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateBucketAsync", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", + "title": "logging createBucket Sample", + "origin": "API_DEFINITION", + "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.create_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "bucket_id", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", + "title": "logging updateBucket Sample", + "origin": "API_DEFINITION", + "description": " Updates a log bucket. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", + "canonical": true, + "file": "config_service_v2.update_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "bucket", + "type": ".google.logging.v2.LogBucket" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogBucket", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", + "title": "logging deleteBucket Sample", + "origin": "API_DEFINITION", + "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", + "canonical": true, + "file": "config_service_v2.delete_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", + "title": "logging undeleteBucket Sample", + "origin": "API_DEFINITION", + "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", + "canonical": true, + "file": "config_service_v2.undelete_bucket.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UndeleteBucket", + "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", + "title": "logging listViews Sample", + "origin": "API_DEFINITION", + "description": " Lists views on a log bucket.", + "canonical": true, + "file": "config_service_v2.list_views.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListViews", + "fullName": "google.logging.v2.ConfigServiceV2.ListViews", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListViewsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListViews", + "fullName": "google.logging.v2.ConfigServiceV2.ListViews", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", + "title": "logging getView Sample", + "origin": "API_DEFINITION", + "description": " Gets a view on a log bucket..", + "canonical": true, + "file": "config_service_v2.get_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetView", + "fullName": "google.logging.v2.ConfigServiceV2.GetView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetView", + "fullName": "google.logging.v2.ConfigServiceV2.GetView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", + "title": "logging createView Sample", + "origin": "API_DEFINITION", + "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", + "canonical": true, + "file": "config_service_v2.create_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateView", + "fullName": "google.logging.v2.ConfigServiceV2.CreateView", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "view_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.logging.v2.LogView" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateView", + "fullName": "google.logging.v2.ConfigServiceV2.CreateView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", + "title": "logging updateView Sample", + "origin": "API_DEFINITION", + "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", + "canonical": true, + "file": "config_service_v2.update_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateView", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.logging.v2.LogView" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogView", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateView", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", + "title": "logging deleteView Sample", + "origin": "API_DEFINITION", + "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", + "canonical": true, + "file": "config_service_v2.delete_view.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteView", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteView", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", + "title": "logging listSinks Sample", + "origin": "API_DEFINITION", + "description": " Lists sinks.", + "canonical": true, + "file": "config_service_v2.list_sinks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListSinksResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListSinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", + "title": "logging getSink Sample", + "origin": "API_DEFINITION", + "description": " Gets a sink.", + "canonical": true, + "file": "config_service_v2.get_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSink", + "fullName": "google.logging.v2.ConfigServiceV2.GetSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetSink", + "fullName": "google.logging.v2.ConfigServiceV2.GetSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", + "title": "logging createSink Sample", + "origin": "API_DEFINITION", + "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "canonical": true, + "file": "config_service_v2.create_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "sink", + "type": ".google.logging.v2.LogSink" + }, + { + "name": "unique_writer_identity", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateSink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", + "title": "logging updateSink Sample", + "origin": "API_DEFINITION", + "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", + "canonical": true, + "file": "config_service_v2.update_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSink", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + }, + { + "name": "sink", + "type": ".google.logging.v2.LogSink" + }, + { + "name": "unique_writer_identity", + "type": "TYPE_BOOL" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogSink", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateSink", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", + "title": "logging deleteSink Sample", + "origin": "API_DEFINITION", + "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", + "canonical": true, + "file": "config_service_v2.delete_sink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", + "async": true, + "parameters": [ + { + "name": "sink_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteSink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateLink_async", + "title": "logging createLink Sample", + "origin": "API_DEFINITION", + "description": " Asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.", + "canonical": true, + "file": "config_service_v2.create_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateLink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "link", + "type": ".google.logging.v2.Link" + }, + { + "name": "link_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateLink", + "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteLink_async", + "title": "logging deleteLink Sample", + "origin": "API_DEFINITION", + "description": " Deletes a link. This will also delete the corresponding BigQuery linked dataset.", + "canonical": true, + "file": "config_service_v2.delete_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteLink", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListLinks_async", + "title": "logging listLinks Sample", + "origin": "API_DEFINITION", + "description": " Lists links.", + "canonical": true, + "file": "config_service_v2.list_links.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListLinksResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListLinks", + "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetLink_async", + "title": "logging getLink Sample", + "origin": "API_DEFINITION", + "description": " Gets a link.", + "canonical": true, + "file": "config_service_v2.get_link.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLink", + "fullName": "google.logging.v2.ConfigServiceV2.GetLink", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.Link", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetLink", + "fullName": "google.logging.v2.ConfigServiceV2.GetLink", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", + "title": "logging listExclusions Sample", + "origin": "API_DEFINITION", + "description": " Lists all the exclusions on the _Default sink in a parent resource.", + "canonical": true, + "file": "config_service_v2.list_exclusions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExclusions", + "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListExclusionsResponse", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "ListExclusions", + "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", + "title": "logging getExclusion Sample", + "origin": "API_DEFINITION", + "description": " Gets the description of an exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.get_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", + "title": "logging createExclusion Sample", + "origin": "API_DEFINITION", + "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", + "canonical": true, + "file": "config_service_v2.create_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "exclusion", + "type": ".google.logging.v2.LogExclusion" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CreateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", + "title": "logging updateExclusion Sample", + "origin": "API_DEFINITION", + "description": " Changes one or more properties of an existing exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.update_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "exclusion", + "type": ".google.logging.v2.LogExclusion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.LogExclusion", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", + "title": "logging deleteExclusion Sample", + "origin": "API_DEFINITION", + "description": " Deletes an exclusion in the _Default sink.", + "canonical": true, + "file": "config_service_v2.delete_exclusion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "DeleteExclusion", + "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", + "title": "logging getCmekSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.get_cmek_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.CmekSettings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", + "title": "logging updateCmekSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.update_cmek_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "cmek_settings", + "type": ".google.logging.v2.CmekSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.CmekSettings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateCmekSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", + "title": "logging getSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.get_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.Settings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "GetSettings", + "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", + "title": "logging updateSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", + "canonical": true, + "file": "config_service_v2.update_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "settings", + "type": ".google.logging.v2.Settings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.logging.v2.Settings", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "UpdateSettings", + "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", + "title": "logging copyLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", + "canonical": true, + "file": "config_service_v2.copy_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CopyLogEntries", + "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "destination", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConfigServiceV2Client", + "fullName": "google.logging.v2.ConfigServiceV2Client" + }, + "method": { + "shortName": "CopyLogEntries", + "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", + "service": { + "shortName": "ConfigServiceV2", + "fullName": "google.logging.v2.ConfigServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", + "title": "logging deleteLog Sample", + "origin": "API_DEFINITION", + "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", + "canonical": true, + "file": "logging_service_v2.delete_log.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLog", + "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", + "async": true, + "parameters": [ + { + "name": "log_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "DeleteLog", + "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", + "title": "logging writeLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", + "canonical": true, + "file": "logging_service_v2.write_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 121, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", + "async": true, + "parameters": [ + { + "name": "log_name", + "type": "TYPE_STRING" + }, + { + "name": "resource", + "type": ".google.api.MonitoredResource" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "entries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "partial_success", + "type": "TYPE_BOOL" + }, + { + "name": "dry_run", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.logging.v2.WriteLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "WriteLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", + "title": "logging listLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", + "canonical": true, + "file": "logging_service_v2.list_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 98, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", + "async": true, + "parameters": [ + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", + "title": "logging listMonitoredResourceDescriptors Sample", + "origin": "API_DEFINITION", + "description": " Lists the descriptors for monitored resource types used by Logging.", + "canonical": true, + "file": "logging_service_v2.list_monitored_resource_descriptors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMonitoredResourceDescriptors", + "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListMonitoredResourceDescriptors", + "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", + "title": "logging listLogs Sample", + "origin": "API_DEFINITION", + "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", + "canonical": true, + "file": "logging_service_v2.list_logs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogs", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.ListLogsResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "ListLogs", + "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", + "title": "logging tailLogEntries Sample", + "origin": "API_DEFINITION", + "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", + "canonical": true, + "file": "logging_service_v2.tail_log_entries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TailLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", + "async": true, + "parameters": [ + { + "name": "resource_names", + "type": "TYPE_STRING[]" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "buffer_window", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.logging.v2.TailLogEntriesResponse", + "client": { + "shortName": "LoggingServiceV2Client", + "fullName": "google.logging.v2.LoggingServiceV2Client" + }, + "method": { + "shortName": "TailLogEntries", + "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", + "service": { + "shortName": "LoggingServiceV2", + "fullName": "google.logging.v2.LoggingServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", + "title": "logging listLogMetrics Sample", + "origin": "API_DEFINITION", + "description": " Lists logs-based metrics.", + "canonical": true, + "file": "metrics_service_v2.list_log_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLogMetrics", + "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.logging.v2.ListLogMetricsResponse", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "ListLogMetrics", + "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", + "title": "logging getLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Gets a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.get_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "GetLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", + "title": "logging createLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Creates a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.create_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metric", + "type": ".google.logging.v2.LogMetric" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "CreateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", + "title": "logging updateLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.update_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + }, + { + "name": "metric", + "type": ".google.logging.v2.LogMetric" + } + ], + "resultType": ".google.logging.v2.LogMetric", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "UpdateLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + }, + { + "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", + "title": "logging deleteLogMetric Sample", + "origin": "API_DEFINITION", + "description": " Deletes a logs-based metric.", + "canonical": true, + "file": "metrics_service_v2.delete_log_metric.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", + "async": true, + "parameters": [ + { + "name": "metric_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MetricsServiceV2Client", + "fullName": "google.logging.v2.MetricsServiceV2Client" + }, + "method": { + "shortName": "DeleteLogMetric", + "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", + "service": { + "shortName": "MetricsServiceV2", + "fullName": "google.logging.v2.MetricsServiceV2" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 00000000..ca1a43eb --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,29 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const ConfigServiceV2Client = v2.ConfigServiceV2Client; +type ConfigServiceV2Client = v2.ConfigServiceV2Client; +const LoggingServiceV2Client = v2.LoggingServiceV2Client; +type LoggingServiceV2Client = v2.LoggingServiceV2Client; +const MetricsServiceV2Client = v2.MetricsServiceV2Client; +type MetricsServiceV2Client = v2.MetricsServiceV2Client; +export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; +export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts new file mode 100644 index 00000000..f749a38b --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts @@ -0,0 +1,5530 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/config_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './config_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for configuring sinks used to route log entries. + * @class + * @memberof v2 + */ +export class ConfigServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + configServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConfigServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConfigServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConfigServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBuckets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), + listViews: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), + listSinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), + listLinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'links'), + listExclusions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=*/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=folders/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel',body: '*',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=*/*/locations/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=organizations/*/locations/*/operations/*}',},{get: '/v2/{name=folders/*/locations/*/operations/*}',},{get: '/v2/{name=billingAccounts/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=*/*/locations/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=organizations/*/locations/*}/operations',},{get: '/v2/{name=folders/*/locations/*}/operations',},{get: '/v2/{name=billingAccounts/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createBucketAsyncResponse = protoFilesRoot.lookup( + '.google.logging.v2.LogBucket') as gax.protobuf.Type; + const createBucketAsyncMetadata = protoFilesRoot.lookup( + '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; + const updateBucketAsyncResponse = protoFilesRoot.lookup( + '.google.logging.v2.LogBucket') as gax.protobuf.Type; + const updateBucketAsyncMetadata = protoFilesRoot.lookup( + '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; + const createLinkResponse = protoFilesRoot.lookup( + '.google.logging.v2.Link') as gax.protobuf.Type; + const createLinkMetadata = protoFilesRoot.lookup( + '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; + const deleteLinkResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteLinkMetadata = protoFilesRoot.lookup( + '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; + const copyLogEntriesResponse = protoFilesRoot.lookup( + '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; + const copyLogEntriesMetadata = protoFilesRoot.lookup( + '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBucketAsync: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBucketAsyncResponse.decode.bind(createBucketAsyncResponse), + createBucketAsyncMetadata.decode.bind(createBucketAsyncMetadata)), + updateBucketAsync: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBucketAsyncResponse.decode.bind(updateBucketAsyncResponse), + updateBucketAsyncMetadata.decode.bind(updateBucketAsyncMetadata)), + createLink: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createLinkResponse.decode.bind(createLinkResponse), + createLinkMetadata.decode.bind(createLinkMetadata)), + deleteLink: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteLinkResponse.decode.bind(deleteLinkResponse), + deleteLinkMetadata.decode.bind(deleteLinkMetadata)), + copyLogEntries: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), + copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.configServiceV2Stub) { + return this.configServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.ConfigServiceV2. + this.configServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.ConfigServiceV2, + 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 configServiceV2StubMethods = + ['listBuckets', 'getBucket', 'createBucketAsync', 'updateBucketAsync', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'createLink', 'deleteLink', 'listLinks', 'getLink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; + for (const methodName of configServiceV2StubMethods) { + const callPromise = this.configServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.configServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read' + ]; + } + + 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 -- + // ------------------- +/** + * Gets a log bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async + */ + getBucket( + request?: protos.google.logging.v2.IGetBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined + ]>; + getBucket( + request: protos.google.logging.v2.IGetBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): void; + getBucket( + request: protos.google.logging.v2.IGetBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): void; + getBucket( + request?: protos.google.logging.v2.IGetBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBucket(request, options, callback); + } +/** + * Creates a log bucket that can be used to store log entries. After a bucket + * has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the log bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * + * For example: + * + * `"projects/my-project/locations/global"` + * @param {string} request.bucketId + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async + */ + createBucket( + request?: protos.google.logging.v2.ICreateBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined + ]>; + createBucket( + request: protos.google.logging.v2.ICreateBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): void; + createBucket( + request: protos.google.logging.v2.ICreateBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): void; + createBucket( + request?: protos.google.logging.v2.ICreateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBucket(request, options, callback); + } +/** + * Updates a log bucket. + * + * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + * `FAILED_PRECONDITION` will be returned. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to update. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The updated bucket. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=retention_days` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async + */ + updateBucket( + request?: protos.google.logging.v2.IUpdateBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined + ]>; + updateBucket( + request: protos.google.logging.v2.IUpdateBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): void; + updateBucket( + request: protos.google.logging.v2.IUpdateBucketRequest, + callback: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): void; + updateBucket( + request?: protos.google.logging.v2.IUpdateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBucket(request, options, callback); + } +/** + * Deletes a log bucket. + * + * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. + * After 7 days, the bucket will be purged and all log entries in the bucket + * will be permanently deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to delete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async + */ + deleteBucket( + request?: protos.google.logging.v2.IDeleteBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined + ]>; + deleteBucket( + request: protos.google.logging.v2.IDeleteBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + deleteBucket( + request: protos.google.logging.v2.IDeleteBucketRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + deleteBucket( + request?: protos.google.logging.v2.IDeleteBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBucket(request, options, callback); + } +/** + * Undeletes a log bucket. A bucket that has been deleted can be undeleted + * within the grace period of 7 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to undelete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js + * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async + */ + undeleteBucket( + request?: protos.google.logging.v2.IUndeleteBucketRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined + ]>; + undeleteBucket( + request: protos.google.logging.v2.IUndeleteBucketRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + undeleteBucket( + request: protos.google.logging.v2.IUndeleteBucketRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): void; + undeleteBucket( + request?: protos.google.logging.v2.IUndeleteBucketRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.undeleteBucket(request, options, callback); + } +/** + * Gets a view on a log bucket.. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the policy: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async + */ + getView( + request?: protos.google.logging.v2.IGetViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined + ]>; + getView( + request: protos.google.logging.v2.IGetViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): void; + getView( + request: protos.google.logging.v2.IGetViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): void; + getView( + request?: protos.google.logging.v2.IGetViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getView(request, options, callback); + } +/** + * Creates a view over log entries in a log bucket. A bucket may contain a + * maximum of 30 views. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket in which to create the view + * + * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {string} request.viewId + * Required. A client-assigned identifier such as `"my-view"`. Identifiers are + * limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogView} request.view + * Required. The new view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async + */ + createView( + request?: protos.google.logging.v2.ICreateViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined + ]>; + createView( + request: protos.google.logging.v2.ICreateViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): void; + createView( + request: protos.google.logging.v2.ICreateViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): void; + createView( + request?: protos.google.logging.v2.ICreateViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createView(request, options, callback); + } +/** + * Updates a view on a log bucket. This method replaces the following fields + * in the existing view with values from the new view: `filter`. + * If an `UNAVAILABLE` error is returned, this indicates that system is not in + * a state where it can update the view. If this occurs, please try again in a + * few minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the view to update + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {google.logging.v2.LogView} request.view + * Required. The updated view. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask that specifies the fields in `view` that need + * an update. A field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=filter` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async + */ + updateView( + request?: protos.google.logging.v2.IUpdateViewRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined + ]>; + updateView( + request: protos.google.logging.v2.IUpdateViewRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): void; + updateView( + request: protos.google.logging.v2.IUpdateViewRequest, + callback: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): void; + updateView( + request?: protos.google.logging.v2.IUpdateViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateView(request, options, callback); + } +/** + * Deletes a view on a log bucket. + * If an `UNAVAILABLE` error is returned, this indicates that system is not in + * a state where it can delete the view. If this occurs, please try again in a + * few minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the view to delete: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_view.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async + */ + deleteView( + request?: protos.google.logging.v2.IDeleteViewRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined + ]>; + deleteView( + request: protos.google.logging.v2.IDeleteViewRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): void; + deleteView( + request: protos.google.logging.v2.IDeleteViewRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): void; + deleteView( + request?: protos.google.logging.v2.IDeleteViewRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteView(request, options, callback); + } +/** + * Gets a sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The resource name of the sink: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async + */ + getSink( + request?: protos.google.logging.v2.IGetSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined + ]>; + getSink( + request: protos.google.logging.v2.IGetSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): void; + getSink( + request: protos.google.logging.v2.IGetSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): void; + getSink( + request?: protos.google.logging.v2.IGetSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSink(request, options, callback); + } +/** + * Creates a sink that exports specified log entries to a destination. The + * export of newly-ingested log entries begins immediately, unless the sink's + * `writer_identity` is not permitted to write to the destination. A sink can + * export log entries only from the resource owning the sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the sink: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * + * For examples: + * + * `"projects/my-project"` + * `"organizations/123456789"` + * @param {google.logging.v2.LogSink} request.sink + * Required. The new sink, whose `name` parameter is a sink identifier that + * is not already in use. + * @param {boolean} [request.uniqueWriterIdentity] + * Optional. Determines the kind of IAM identity returned as `writer_identity` + * in the new sink. If this value is omitted or set to false, and if the + * sink's parent is a project, then the value returned as `writer_identity` is + * the same group or service account used by Cloud Logging before the addition + * of writer identities to this API. The sink's destination must be in the + * same project as the sink itself. + * + * If this field is set to true, or if the sink is owned by a non-project + * resource such as an organization, then the value of `writer_identity` will + * be a unique service account used only for exports from the new sink. For + * more information, see `writer_identity` in + * {@link protos.google.logging.v2.LogSink|LogSink}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async + */ + createSink( + request?: protos.google.logging.v2.ICreateSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined + ]>; + createSink( + request: protos.google.logging.v2.ICreateSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): void; + createSink( + request: protos.google.logging.v2.ICreateSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): void; + createSink( + request?: protos.google.logging.v2.ICreateSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSink(request, options, callback); + } +/** + * Updates a sink. This method replaces the following fields in the existing + * sink with values from the new sink: `destination`, and `filter`. + * + * The updated sink might also have a new `writer_identity`; see the + * `unique_writer_identity` field. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The full resource name of the sink to update, including the + * parent resource and the sink identifier: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {google.logging.v2.LogSink} request.sink + * Required. The updated sink, whose name is the same identifier that appears + * as part of `sink_name`. + * @param {boolean} [request.uniqueWriterIdentity] + * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} + * for a description of this field. When updating a sink, the effect of this + * field on the value of `writer_identity` in the updated sink depends on both + * the old and new values of this field: + * + * + If the old and new values of this field are both false or both true, + * then there is no change to the sink's `writer_identity`. + * + If the old value is false and the new value is true, then + * `writer_identity` is changed to a unique service account. + * + It is an error if the old value is true and the new value is + * set to false or defaulted to false. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask that specifies the fields in `sink` that need + * an update. A sink field will be overwritten if, and only if, it is + * in the update mask. `name` and output only fields cannot be updated. + * + * An empty `updateMask` is temporarily treated as using the following mask + * for backwards compatibility purposes: + * + * `destination,filter,includeChildren` + * + * At some point in the future, behavior will be removed and specifying an + * empty `updateMask` will be an error. + * + * For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=filter` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async + */ + updateSink( + request?: protos.google.logging.v2.IUpdateSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined + ]>; + updateSink( + request: protos.google.logging.v2.IUpdateSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): void; + updateSink( + request: protos.google.logging.v2.IUpdateSinkRequest, + callback: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): void; + updateSink( + request?: protos.google.logging.v2.IUpdateSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSink(request, options, callback); + } +/** + * Deletes a sink. If the sink has a unique `writer_identity`, then that + * service account is also deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.sinkName + * Required. The full resource name of the sink to delete, including the + * parent resource and the sink identifier: + * + * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + * + * For example: + * + * `"projects/my-project/sinks/my-sink"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_sink.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async + */ + deleteSink( + request?: protos.google.logging.v2.IDeleteSinkRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined + ]>; + deleteSink( + request: protos.google.logging.v2.IDeleteSinkRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): void; + deleteSink( + request: protos.google.logging.v2.IDeleteSinkRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): void; + deleteSink( + request?: protos.google.logging.v2.IDeleteSinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'sink_name': request.sinkName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSink(request, options, callback); + } +/** + * Gets a link. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the link: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Link|Link}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetLink_async + */ + getLink( + request?: protos.google.logging.v2.IGetLinkRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined + ]>; + getLink( + request: protos.google.logging.v2.IGetLinkRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): void; + getLink( + request: protos.google.logging.v2.IGetLinkRequest, + callback: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): void; + getLink( + request?: protos.google.logging.v2.IGetLinkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLink(request, options, callback); + } +/** + * Gets the description of an exclusion in the _Default sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of an existing exclusion: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async + */ + getExclusion( + request?: protos.google.logging.v2.IGetExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined + ]>; + getExclusion( + request: protos.google.logging.v2.IGetExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): void; + getExclusion( + request: protos.google.logging.v2.IGetExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): void; + getExclusion( + request?: protos.google.logging.v2.IGetExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExclusion(request, options, callback); + } +/** + * Creates a new exclusion in the _Default sink in a specified parent + * resource. Only log entries belonging to that resource can be excluded. You + * can have up to 10 exclusions in a resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource in which to create the exclusion: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * + * For examples: + * + * `"projects/my-logging-project"` + * `"organizations/123456789"` + * @param {google.logging.v2.LogExclusion} request.exclusion + * Required. The new exclusion, whose `name` parameter is an exclusion name + * that is not already used in the parent resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async + */ + createExclusion( + request?: protos.google.logging.v2.ICreateExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined + ]>; + createExclusion( + request: protos.google.logging.v2.ICreateExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): void; + createExclusion( + request: protos.google.logging.v2.ICreateExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): void; + createExclusion( + request?: protos.google.logging.v2.ICreateExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExclusion(request, options, callback); + } +/** + * Changes one or more properties of an existing exclusion in the _Default + * sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the exclusion to update: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {google.logging.v2.LogExclusion} request.exclusion + * Required. New values for the existing exclusion. Only the fields specified + * in `update_mask` are relevant. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A non-empty list of fields to change in the existing exclusion. + * New values for the fields are taken from the corresponding fields in the + * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. + * Fields not mentioned in `update_mask` are not changed and are ignored in + * the request. + * + * For example, to change the filter and description of an exclusion, + * specify an `update_mask` of `"filter,description"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async + */ + updateExclusion( + request?: protos.google.logging.v2.IUpdateExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined + ]>; + updateExclusion( + request: protos.google.logging.v2.IUpdateExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): void; + updateExclusion( + request: protos.google.logging.v2.IUpdateExclusionRequest, + callback: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): void; + updateExclusion( + request?: protos.google.logging.v2.IUpdateExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateExclusion(request, options, callback); + } +/** + * Deletes an exclusion in the _Default sink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of an existing exclusion to delete: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * For example: + * + * `"projects/my-project/exclusions/my-exclusion"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async + */ + deleteExclusion( + request?: protos.google.logging.v2.IDeleteExclusionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined + ]>; + deleteExclusion( + request: protos.google.logging.v2.IDeleteExclusionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): void; + deleteExclusion( + request: protos.google.logging.v2.IDeleteExclusionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): void; + deleteExclusion( + request?: protos.google.logging.v2.IDeleteExclusionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteExclusion(request, options, callback); + } +/** + * Gets the Logging CMEK settings for the given resource. + * + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource for which to retrieve CMEK settings. + * + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * + * For example: + * + * `"organizations/12345/cmekSettings"` + * + * Note: CMEK for the Log Router can be configured for Google Cloud projects, + * folders, organizations and billing accounts. Once configured for an + * organization, it applies to all projects and folders in the Google Cloud + * organization. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async + */ + getCmekSettings( + request?: protos.google.logging.v2.IGetCmekSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined + ]>; + getCmekSettings( + request: protos.google.logging.v2.IGetCmekSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + getCmekSettings( + request: protos.google.logging.v2.IGetCmekSettingsRequest, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + getCmekSettings( + request?: protos.google.logging.v2.IGetCmekSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCmekSettings(request, options, callback); + } +/** + * Updates the Log Router CMEK settings for the given resource. + * + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * + * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} + * will fail if 1) `kms_key_name` is invalid, or 2) the associated service + * account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + * 3) access to the key is disabled. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the CMEK settings to update. + * + * "projects/[PROJECT_ID]/cmekSettings" + * "organizations/[ORGANIZATION_ID]/cmekSettings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" + * "folders/[FOLDER_ID]/cmekSettings" + * + * For example: + * + * `"organizations/12345/cmekSettings"` + * + * Note: CMEK for the Log Router can currently only be configured for Google + * Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * @param {google.logging.v2.CmekSettings} request.cmekSettings + * Required. The CMEK settings to update. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask identifying which fields from `cmek_settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * + * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. + * + * For example: `"updateMask=kmsKeyName"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async + */ + updateCmekSettings( + request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined + ]>; + updateCmekSettings( + request: protos.google.logging.v2.IUpdateCmekSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateCmekSettings( + request: protos.google.logging.v2.IUpdateCmekSettingsRequest, + callback: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateCmekSettings( + request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCmekSettings(request, options, callback); + } +/** + * Gets the Log Router settings for the given resource. + * + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource for which to retrieve settings. + * + * "projects/[PROJECT_ID]/settings" + * "organizations/[ORGANIZATION_ID]/settings" + * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" + * "folders/[FOLDER_ID]/settings" + * + * For example: + * + * `"organizations/12345/settings"` + * + * Note: Settings for the Log Router can be get for Google Cloud projects, + * folders, organizations and billing accounts. Currently it can only be + * configured for organizations. Once configured for an organization, it + * applies to all projects and folders in the Google Cloud organization. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.get_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async + */ + getSettings( + request?: protos.google.logging.v2.IGetSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined + ]>; + getSettings( + request: protos.google.logging.v2.IGetSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request: protos.google.logging.v2.IGetSettingsRequest, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request?: protos.google.logging.v2.IGetSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSettings(request, options, callback); + } +/** + * Updates the Log Router settings for the given resource. + * + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * + * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} + * will fail if 1) `kms_key_name` is invalid, or 2) the associated service + * account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or + * 3) access to the key is disabled. 4) `location_id` is not supported by + * Logging. 5) `location_id` violate OrgPolicy. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the settings to update. + * + * "organizations/[ORGANIZATION_ID]/settings" + * + * For example: + * + * `"organizations/12345/settings"` + * + * Note: Settings for the Log Router can currently only be configured for + * Google Cloud organizations. Once configured, it applies to all projects and + * folders in the Google Cloud organization. + * @param {google.logging.v2.Settings} request.settings + * Required. The settings to update. + * + * See [Enabling CMEK for Log + * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) + * for more information. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask identifying which fields from `settings` should + * be updated. A field will be overwritten if and only if it is in the update + * mask. Output only fields cannot be updated. + * + * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. + * + * For example: `"updateMask=kmsKeyName"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_settings.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async + */ + updateSettings( + request?: protos.google.logging.v2.IUpdateSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined + ]>; + updateSettings( + request: protos.google.logging.v2.IUpdateSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request: protos.google.logging.v2.IUpdateSettingsRequest, + callback: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request?: protos.google.logging.v2.IUpdateSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSettings(request, options, callback); + } + +/** + * Creates a log bucket asynchronously that can be used to store log entries. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource in which to create the log bucket: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * + * For example: + * + * `"projects/my-project/locations/global"` + * @param {string} request.bucketId + * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers + * are limited to 100 characters and can include only letters, digits, + * underscores, hyphens, and periods. + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The new bucket. The region specified in the new bucket must be + * compliant with any Location Restriction Org Policy. The name field in the + * bucket is ignored. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async + */ + createBucketAsync( + request?: protos.google.logging.v2.ICreateBucketRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBucketAsync( + request: protos.google.logging.v2.ICreateBucketRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBucketAsync( + request: protos.google.logging.v2.ICreateBucketRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBucketAsync( + request?: protos.google.logging.v2.ICreateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBucketAsync(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async + */ + async checkCreateBucketAsyncProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a log bucket asynchronously. + * + * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then + * `FAILED_PRECONDITION` will be returned. + * + * After a bucket has been created, the bucket's location cannot be changed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the bucket to update. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-bucket"` + * @param {google.logging.v2.LogBucket} request.bucket + * Required. The updated bucket. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask that specifies the fields in `bucket` that need an + * update. A bucket field will be overwritten if, and only if, it is in the + * update mask. `name` and output only fields cannot be updated. + * + * For a detailed `FieldMask` definition, see: + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + * + * For example: `updateMask=retention_days` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async + */ + updateBucketAsync( + request?: protos.google.logging.v2.IUpdateBucketRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBucketAsync( + request: protos.google.logging.v2.IUpdateBucketRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBucketAsync( + request: protos.google.logging.v2.IUpdateBucketRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBucketAsync( + request?: protos.google.logging.v2.IUpdateBucketRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBucketAsync(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async + */ + async checkUpdateBucketAsyncProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Asynchronously creates a linked dataset in BigQuery which makes it possible + * to use BigQuery to read the logs stored in the log bucket. A log bucket may + * currently only contain one link. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The full resource name of the bucket to create a link for. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {google.logging.v2.Link} request.link + * Required. The new link. + * @param {string} request.linkId + * Required. The ID to use for the link. The link_id can have up to 100 + * characters. A valid link_id must only have alphanumeric characters and + * underscores within it. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async + */ + createLink( + request?: protos.google.logging.v2.ICreateLinkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createLink( + request: protos.google.logging.v2.ICreateLinkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createLink( + request: protos.google.logging.v2.ICreateLinkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createLink( + request?: protos.google.logging.v2.ICreateLinkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createLink(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async + */ + async checkCreateLinkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a link. This will also delete the corresponding BigQuery linked + * dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The full resource name of the link to delete. + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async + */ + deleteLink( + request?: protos.google.logging.v2.IDeleteLinkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteLink( + request: protos.google.logging.v2.IDeleteLinkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteLink( + request: protos.google.logging.v2.IDeleteLinkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteLink( + request?: protos.google.logging.v2.IDeleteLinkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLink(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async + */ + async checkDeleteLinkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Copies a set of log entries from a log bucket to a Cloud Storage bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Log bucket from which to copy log entries. + * + * For example: + * + * `"projects/my-project/locations/global/buckets/my-source-bucket"` + * @param {string} [request.filter] + * Optional. A filter specifying which log entries to copy. The filter must be + * no more than 20k characters. An empty filter matches all log entries. + * @param {string} request.destination + * Required. Destination to which to copy log entries. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js + * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async + */ + copyLogEntries( + request?: protos.google.logging.v2.ICopyLogEntriesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + copyLogEntries( + request: protos.google.logging.v2.ICopyLogEntriesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyLogEntries( + request: protos.google.logging.v2.ICopyLogEntriesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyLogEntries( + request?: protos.google.logging.v2.ICopyLogEntriesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|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 || {}; + this.initialize(); + return this.innerApiCalls.copyLogEntries(request, options, callback); + } +/** + * Check the status of the long running operation returned by `copyLogEntries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js + * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async + */ + async checkCopyLogEntriesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists log buckets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBucketsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuckets( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogBucket[], + protos.google.logging.v2.IListBucketsRequest|null, + protos.google.logging.v2.IListBucketsResponse + ]>; + listBuckets( + request: protos.google.logging.v2.IListBucketsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): void; + listBuckets( + request: protos.google.logging.v2.IListBucketsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): void; + listBuckets( + request?: protos.google.logging.v2.IListBucketsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>, + callback?: PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse|null|undefined, + protos.google.logging.v2.ILogBucket>): + Promise<[ + protos.google.logging.v2.ILogBucket[], + protos.google.logging.v2.IListBucketsRequest|null, + protos.google.logging.v2.IListBucketsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBuckets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogBucket|LogBucket} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBucketsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBucketsStream( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.createStream( + this.innerApiCalls.listBuckets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuckets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogBucket|LogBucket}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_buckets.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async + */ + listBucketsAsync( + request?: protos.google.logging.v2.IListBucketsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.asyncIterate( + this.innerApiCalls['listBuckets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists views on a log bucket. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogView|LogView}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listViewsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listViews( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogView[], + protos.google.logging.v2.IListViewsRequest|null, + protos.google.logging.v2.IListViewsResponse + ]>; + listViews( + request: protos.google.logging.v2.IListViewsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): void; + listViews( + request: protos.google.logging.v2.IListViewsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): void; + listViews( + request?: protos.google.logging.v2.IListViewsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>, + callback?: PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse|null|undefined, + protos.google.logging.v2.ILogView>): + Promise<[ + protos.google.logging.v2.ILogView[], + protos.google.logging.v2.IListViewsRequest|null, + protos.google.logging.v2.IListViewsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listViews(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogView|LogView} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listViewsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listViewsStream( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.createStream( + this.innerApiCalls.listViews as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listViews`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogView|LogView}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_views.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async + */ + listViewsAsync( + request?: protos.google.logging.v2.IListViewsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.asyncIterate( + this.innerApiCalls['listViews'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists sinks. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogSink|LogSink}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSinks( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogSink[], + protos.google.logging.v2.IListSinksRequest|null, + protos.google.logging.v2.IListSinksResponse + ]>; + listSinks( + request: protos.google.logging.v2.IListSinksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): void; + listSinks( + request: protos.google.logging.v2.IListSinksRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): void; + listSinks( + request?: protos.google.logging.v2.IListSinksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>, + callback?: PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse|null|undefined, + protos.google.logging.v2.ILogSink>): + Promise<[ + protos.google.logging.v2.ILogSink[], + protos.google.logging.v2.IListSinksRequest|null, + protos.google.logging.v2.IListSinksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSinks(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogSink|LogSink} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSinksStream( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.createStream( + this.innerApiCalls.listSinks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogSink|LogSink}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_sinks.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async + */ + listSinksAsync( + request?: protos.google.logging.v2.IListSinksRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.asyncIterate( + this.innerApiCalls['listSinks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists links. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.Link|Link}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLinks( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILink[], + protos.google.logging.v2.IListLinksRequest|null, + protos.google.logging.v2.IListLinksResponse + ]>; + listLinks( + request: protos.google.logging.v2.IListLinksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): void; + listLinks( + request: protos.google.logging.v2.IListLinksRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): void; + listLinks( + request?: protos.google.logging.v2.IListLinksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse|null|undefined, + protos.google.logging.v2.ILink>): + Promise<[ + protos.google.logging.v2.ILink[], + protos.google.logging.v2.IListLinksRequest|null, + protos.google.logging.v2.IListLinksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLinks(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.Link|Link} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLinksStream( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.createStream( + this.innerApiCalls.listLinks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.Link|Link}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_links.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListLinks_async + */ + listLinksAsync( + request?: protos.google.logging.v2.IListLinksRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.asyncIterate( + this.innerApiCalls['listLinks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all the exclusions on the _Default sink in a parent resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExclusionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExclusions( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogExclusion[], + protos.google.logging.v2.IListExclusionsRequest|null, + protos.google.logging.v2.IListExclusionsResponse + ]>; + listExclusions( + request: protos.google.logging.v2.IListExclusionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): void; + listExclusions( + request: protos.google.logging.v2.IListExclusionsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): void; + listExclusions( + request?: protos.google.logging.v2.IListExclusionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>, + callback?: PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse|null|undefined, + protos.google.logging.v2.ILogExclusion>): + Promise<[ + protos.google.logging.v2.ILogExclusion[], + protos.google.logging.v2.IListExclusionsRequest|null, + protos.google.logging.v2.IListExclusionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExclusions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExclusionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExclusionsStream( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.createStream( + this.innerApiCalls.listExclusions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExclusions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogExclusion|LogExclusion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_exclusions.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async + */ + listExclusionsAsync( + request?: protos.google.logging.v2.IListExclusionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.asyncIterate( + this.innerApiCalls['listExclusions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.configServiceV2Stub && !this._terminated) { + return this.configServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json new file mode 100644 index 00000000..0e890aa4 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json @@ -0,0 +1,169 @@ +{ + "interfaces": { + "google.logging.v2.ConfigServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "ListBuckets": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBucketAsync": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBucketAsync": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeleteBucket": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListViews": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteView": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSinks": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateSink": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteSink": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListLinks": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetLink": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListExclusions": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateExclusion": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateExclusion": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetCmekSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCmekSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CopyLogEntries": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.proto" +] 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 00000000..047d5888 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,512 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.logging.v2", + "libraryPackage": "@google-cloud/logging", + "services": { + "ConfigServiceV2": { + "clients": { + "grpc": { + "libraryClient": "ConfigServiceV2Client", + "rpcs": { + "GetBucket": { + "methods": [ + "getBucket" + ] + }, + "CreateBucket": { + "methods": [ + "createBucket" + ] + }, + "UpdateBucket": { + "methods": [ + "updateBucket" + ] + }, + "DeleteBucket": { + "methods": [ + "deleteBucket" + ] + }, + "UndeleteBucket": { + "methods": [ + "undeleteBucket" + ] + }, + "GetView": { + "methods": [ + "getView" + ] + }, + "CreateView": { + "methods": [ + "createView" + ] + }, + "UpdateView": { + "methods": [ + "updateView" + ] + }, + "DeleteView": { + "methods": [ + "deleteView" + ] + }, + "GetSink": { + "methods": [ + "getSink" + ] + }, + "CreateSink": { + "methods": [ + "createSink" + ] + }, + "UpdateSink": { + "methods": [ + "updateSink" + ] + }, + "DeleteSink": { + "methods": [ + "deleteSink" + ] + }, + "GetLink": { + "methods": [ + "getLink" + ] + }, + "GetExclusion": { + "methods": [ + "getExclusion" + ] + }, + "CreateExclusion": { + "methods": [ + "createExclusion" + ] + }, + "UpdateExclusion": { + "methods": [ + "updateExclusion" + ] + }, + "DeleteExclusion": { + "methods": [ + "deleteExclusion" + ] + }, + "GetCmekSettings": { + "methods": [ + "getCmekSettings" + ] + }, + "UpdateCmekSettings": { + "methods": [ + "updateCmekSettings" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateBucketAsync": { + "methods": [ + "createBucketAsync" + ] + }, + "UpdateBucketAsync": { + "methods": [ + "updateBucketAsync" + ] + }, + "CreateLink": { + "methods": [ + "createLink" + ] + }, + "DeleteLink": { + "methods": [ + "deleteLink" + ] + }, + "CopyLogEntries": { + "methods": [ + "copyLogEntries" + ] + }, + "ListBuckets": { + "methods": [ + "listBuckets", + "listBucketsStream", + "listBucketsAsync" + ] + }, + "ListViews": { + "methods": [ + "listViews", + "listViewsStream", + "listViewsAsync" + ] + }, + "ListSinks": { + "methods": [ + "listSinks", + "listSinksStream", + "listSinksAsync" + ] + }, + "ListLinks": { + "methods": [ + "listLinks", + "listLinksStream", + "listLinksAsync" + ] + }, + "ListExclusions": { + "methods": [ + "listExclusions", + "listExclusionsStream", + "listExclusionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConfigServiceV2Client", + "rpcs": { + "GetBucket": { + "methods": [ + "getBucket" + ] + }, + "CreateBucket": { + "methods": [ + "createBucket" + ] + }, + "UpdateBucket": { + "methods": [ + "updateBucket" + ] + }, + "DeleteBucket": { + "methods": [ + "deleteBucket" + ] + }, + "UndeleteBucket": { + "methods": [ + "undeleteBucket" + ] + }, + "GetView": { + "methods": [ + "getView" + ] + }, + "CreateView": { + "methods": [ + "createView" + ] + }, + "UpdateView": { + "methods": [ + "updateView" + ] + }, + "DeleteView": { + "methods": [ + "deleteView" + ] + }, + "GetSink": { + "methods": [ + "getSink" + ] + }, + "CreateSink": { + "methods": [ + "createSink" + ] + }, + "UpdateSink": { + "methods": [ + "updateSink" + ] + }, + "DeleteSink": { + "methods": [ + "deleteSink" + ] + }, + "GetLink": { + "methods": [ + "getLink" + ] + }, + "GetExclusion": { + "methods": [ + "getExclusion" + ] + }, + "CreateExclusion": { + "methods": [ + "createExclusion" + ] + }, + "UpdateExclusion": { + "methods": [ + "updateExclusion" + ] + }, + "DeleteExclusion": { + "methods": [ + "deleteExclusion" + ] + }, + "GetCmekSettings": { + "methods": [ + "getCmekSettings" + ] + }, + "UpdateCmekSettings": { + "methods": [ + "updateCmekSettings" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateBucketAsync": { + "methods": [ + "createBucketAsync" + ] + }, + "UpdateBucketAsync": { + "methods": [ + "updateBucketAsync" + ] + }, + "CreateLink": { + "methods": [ + "createLink" + ] + }, + "DeleteLink": { + "methods": [ + "deleteLink" + ] + }, + "CopyLogEntries": { + "methods": [ + "copyLogEntries" + ] + }, + "ListBuckets": { + "methods": [ + "listBuckets", + "listBucketsStream", + "listBucketsAsync" + ] + }, + "ListViews": { + "methods": [ + "listViews", + "listViewsStream", + "listViewsAsync" + ] + }, + "ListSinks": { + "methods": [ + "listSinks", + "listSinksStream", + "listSinksAsync" + ] + }, + "ListLinks": { + "methods": [ + "listLinks", + "listLinksStream", + "listLinksAsync" + ] + }, + "ListExclusions": { + "methods": [ + "listExclusions", + "listExclusionsStream", + "listExclusionsAsync" + ] + } + } + } + } + }, + "LoggingServiceV2": { + "clients": { + "grpc": { + "libraryClient": "LoggingServiceV2Client", + "rpcs": { + "DeleteLog": { + "methods": [ + "deleteLog" + ] + }, + "WriteLogEntries": { + "methods": [ + "writeLogEntries" + ] + }, + "TailLogEntries": { + "methods": [ + "tailLogEntries" + ] + }, + "ListLogEntries": { + "methods": [ + "listLogEntries", + "listLogEntriesStream", + "listLogEntriesAsync" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListLogs": { + "methods": [ + "listLogs", + "listLogsStream", + "listLogsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "LoggingServiceV2Client", + "rpcs": { + "DeleteLog": { + "methods": [ + "deleteLog" + ] + }, + "WriteLogEntries": { + "methods": [ + "writeLogEntries" + ] + }, + "ListLogEntries": { + "methods": [ + "listLogEntries", + "listLogEntriesStream", + "listLogEntriesAsync" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListLogs": { + "methods": [ + "listLogs", + "listLogsStream", + "listLogsAsync" + ] + } + } + } + } + }, + "MetricsServiceV2": { + "clients": { + "grpc": { + "libraryClient": "MetricsServiceV2Client", + "rpcs": { + "GetLogMetric": { + "methods": [ + "getLogMetric" + ] + }, + "CreateLogMetric": { + "methods": [ + "createLogMetric" + ] + }, + "UpdateLogMetric": { + "methods": [ + "updateLogMetric" + ] + }, + "DeleteLogMetric": { + "methods": [ + "deleteLogMetric" + ] + }, + "ListLogMetrics": { + "methods": [ + "listLogMetrics", + "listLogMetricsStream", + "listLogMetricsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MetricsServiceV2Client", + "rpcs": { + "GetLogMetric": { + "methods": [ + "getLogMetric" + ] + }, + "CreateLogMetric": { + "methods": [ + "createLogMetric" + ] + }, + "UpdateLogMetric": { + "methods": [ + "updateLogMetric" + ] + }, + "DeleteLogMetric": { + "methods": [ + "deleteLogMetric" + ] + }, + "ListLogMetrics": { + "methods": [ + "listLogMetrics", + "listLogMetricsStream", + "listLogMetricsAsync" + ] + } + } + } + } + } + } +} 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 00000000..75a03763 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,21 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {ConfigServiceV2Client} from './config_service_v2_client'; +export {LoggingServiceV2Client} from './logging_service_v2_client'; +export {MetricsServiceV2Client} from './metrics_service_v2_client'; diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts new file mode 100644 index 00000000..cdf06265 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts @@ -0,0 +1,2754 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/logging_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './logging_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting and querying logs. + * @class + * @memberof v2 + */ +export class LoggingServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + loggingServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of LoggingServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new LoggingServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof LoggingServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogEntries: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), + listMonitoredResourceDescriptors: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), + listLogs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // Some methods on this API support automatically batching + // requests; denote this. + + this.descriptors.batching = { + writeLogEntries: new this._gaxModule.BundleDescriptor( + 'entries', + ['log_name','resource','labels'], + null, + this._gaxModule.GrpcClient.createByteLengthFunction( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.loggingServiceV2Stub) { + return this.loggingServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.LoggingServiceV2. + this.loggingServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.LoggingServiceV2, + 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 loggingServiceV2StubMethods = + ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; + for (const methodName of loggingServiceV2StubMethods) { + const callPromise = this.loggingServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.batching?.[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.loggingServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write' + ]; + } + + 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 -- + // ------------------- +/** + * Deletes all the log entries in a log for the _Default Log Bucket. The log + * reappears if it receives new entries. Log entries written shortly before + * the delete operation might not be deleted. Entries received after the + * delete operation with a timestamp before the operation will be deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.logName + * Required. The resource name of the log to delete: + * + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * + * `[LOG_ID]` must be URL-encoded. For example, + * `"projects/my-project-id/logs/syslog"`, + * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. + * + * For more information about log names, see + * {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.delete_log.js + * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async + */ + deleteLog( + request?: protos.google.logging.v2.IDeleteLogRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined + ]>; + deleteLog( + request: protos.google.logging.v2.IDeleteLogRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): void; + deleteLog( + request: protos.google.logging.v2.IDeleteLogRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): void; + deleteLog( + request?: protos.google.logging.v2.IDeleteLogRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'log_name': request.logName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLog(request, options, callback); + } +/** + * Writes log entries to Logging. This API method is the + * only way to send log entries to Logging. This method + * is used, directly or indirectly, by the Logging agent + * (fluentd) and all logging libraries configured to use Logging. + * A single request may contain log entries for a maximum of 1000 + * different resources (projects, organizations, billing accounts or + * folders) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.logName] + * Optional. A default log resource name that is assigned to all log entries + * in `entries` that do not specify a value for `log_name`: + * + * * `projects/[PROJECT_ID]/logs/[LOG_ID]` + * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` + * * `folders/[FOLDER_ID]/logs/[LOG_ID]` + * + * `[LOG_ID]` must be URL-encoded. For example: + * + * "projects/my-project-id/logs/syslog" + * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" + * + * The permission `logging.logEntries.create` is needed on each project, + * organization, billing account, or folder that is receiving new log + * entries, whether the resource is specified in `logName` or in an + * individual log entry. + * @param {google.api.MonitoredResource} [request.resource] + * Optional. A default monitored resource object that is assigned to all log + * entries in `entries` that do not specify a value for `resource`. Example: + * + * { "type": "gce_instance", + * "labels": { + * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + * + * See {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {number[]} [request.labels] + * Optional. Default labels that are added to the `labels` field of all log + * entries in `entries`. If a log entry already has a label with the same key + * as a label in this parameter, then the log entry's label is not changed. + * See {@link protos.google.logging.v2.LogEntry|LogEntry}. + * @param {number[]} request.entries + * Required. The log entries to send to Logging. The order of log + * entries in this list does not matter. Values supplied in this method's + * `log_name`, `resource`, and `labels` fields are copied into those log + * entries in this list that do not include values for their corresponding + * fields. For more information, see the + * {@link protos.google.logging.v2.LogEntry|LogEntry} type. + * + * If the `timestamp` or `insert_id` fields are missing in log entries, then + * this method supplies the current time or a unique identifier, respectively. + * The supplied values are chosen so that, among the log entries that did not + * supply their own values, the entries earlier in the list will sort before + * the entries later in the list. See the `entries.list` method. + * + * Log entries with timestamps that are more than the + * [logs retention period](https://cloud.google.com/logging/quotas) in + * the past or more than 24 hours in the future will not be available when + * calling `entries.list`. However, those log entries can still be [exported + * with + * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). + * + * To improve throughput and to avoid exceeding the + * [quota limit](https://cloud.google.com/logging/quotas) for calls to + * `entries.write`, you should try to include several log entries in this + * list, rather than calling this method for each individual log entry. + * @param {boolean} [request.partialSuccess] + * Optional. Whether a batch's valid entries should be written even if some + * other entry failed due to a permanent error such as INVALID_ARGUMENT or + * PERMISSION_DENIED. If any entry failed, then the response status is the + * response status of one of the failed entries. The response will include + * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by + * the entries' zero-based index in the `entries`. Failed requests for which + * no entries are written will not include per-entry errors. + * @param {boolean} [request.dryRun] + * Optional. If true, the request should expect normal response, but the + * entries won't be persisted nor exported. Useful for checking whether the + * logging API endpoints are working properly before sending valuable data. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async + */ + writeLogEntries( + request?: protos.google.logging.v2.IWriteLogEntriesRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined + ]>; + writeLogEntries( + request: protos.google.logging.v2.IWriteLogEntriesRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): void; + writeLogEntries( + request: protos.google.logging.v2.IWriteLogEntriesRequest, + callback: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): void; + writeLogEntries( + request?: protos.google.logging.v2.IWriteLogEntriesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest|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 || {}; + this.initialize(); + return this.innerApiCalls.writeLogEntries(request, options, callback); + } + +/** + * Streaming read of log entries as they are ingested. Until the stream is + * terminated, it will continue reading logs. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and + * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async + */ + tailLogEntries( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.tailLogEntries(null, options); + } + + /** + * Lists log entries. Use this method to retrieve log entries that originated + * from a project/folder/organization/billing account. For ways to export log + * entries, see [Exporting + * Logs](https://cloud.google.com/logging/docs/export). + * + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogEntriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogEntries( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogEntry[], + protos.google.logging.v2.IListLogEntriesRequest|null, + protos.google.logging.v2.IListLogEntriesResponse + ]>; + listLogEntries( + request: protos.google.logging.v2.IListLogEntriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): void; + listLogEntries( + request: protos.google.logging.v2.IListLogEntriesRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): void; + listLogEntries( + request?: protos.google.logging.v2.IListLogEntriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse|null|undefined, + protos.google.logging.v2.ILogEntry>): + Promise<[ + protos.google.logging.v2.ILogEntry[], + protos.google.logging.v2.IListLogEntriesRequest|null, + protos.google.logging.v2.IListLogEntriesResponse + ]>|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 || {}; + this.initialize(); + return this.innerApiCalls.listLogEntries(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogEntry|LogEntry} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogEntriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogEntriesStream( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.createStream( + this.innerApiCalls.listLogEntries as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogEntries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogEntry|LogEntry}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async + */ + listLogEntriesAsync( + request?: protos.google.logging.v2.IListLogEntriesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.asyncIterate( + this.innerApiCalls['listLogEntries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the descriptors for monitored resource types used by Logging. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMonitoredResourceDescriptors( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse + ]>; + listMonitoredResourceDescriptors( + request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): void; + listMonitoredResourceDescriptors( + request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): void; + listMonitoredResourceDescriptors( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>, + callback?: PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, + protos.google.api.IMonitoredResourceDescriptor>): + Promise<[ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse + ]>|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 || {}; + this.initialize(); + return this.innerApiCalls.listMonitoredResourceDescriptors(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMonitoredResourceDescriptorsStream( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.createStream( + this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async + */ + listMonitoredResourceDescriptorsAsync( + request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( + this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the logs in projects, organizations, folders, or billing accounts. + * Only logs that have entries are listed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of string. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogs( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + Promise<[ + string[], + protos.google.logging.v2.IListLogsRequest|null, + protos.google.logging.v2.IListLogsResponse + ]>; + listLogs( + request: protos.google.logging.v2.IListLogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): void; + listLogs( + request: protos.google.logging.v2.IListLogsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): void; + listLogs( + request?: protos.google.logging.v2.IListLogsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse|null|undefined, + string>): + Promise<[ + string[], + protos.google.logging.v2.IListLogsRequest|null, + protos.google.logging.v2.IListLogsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLogs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing string on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogsStream( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.createStream( + this.innerApiCalls.listLogs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_logs.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async + */ + listLogsAsync( + request?: protos.google.logging.v2.IListLogsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.asyncIterate( + this.innerApiCalls['listLogs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.loggingServiceV2Stub && !this._terminated) { + return this.loggingServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json new file mode 100644 index 00000000..342e96e9 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json @@ -0,0 +1,67 @@ +{ + "interfaces": { + "google.logging.v2.LoggingServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "DeleteLog": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "WriteLogEntries": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default", + "bundling": { + "element_count_threshold": 1000, + "request_byte_threshold": 1048576, + "delay_threshold_millis": 50, + "element_count_limit": 1000000 + } + }, + "ListLogEntries": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListMonitoredResourceDescriptors": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListLogs": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "TailLogEntries": { + "timeout_millis": 3600000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.proto" +] diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts new file mode 100644 index 00000000..39c5205d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts @@ -0,0 +1,2288 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/metrics_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './metrics_service_v2_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for configuring logs-based metrics. + * @class + * @memberof v2 + */ +export class MetricsServiceV2Client { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + metricsServiceV2Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MetricsServiceV2Client. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new MetricsServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof MetricsServiceV2Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/cmekSettings' + ), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/exclusions/{exclusion}' + ), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' + ), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' + ), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' + ), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/logs/{log}' + ), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/settings' + ), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( + 'billingAccounts/{billing_account}/sinks/{sink}' + ), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/cmekSettings' + ), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/exclusions/{exclusion}' + ), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}' + ), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' + ), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' + ), + folderLogPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/logs/{log}' + ), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/settings' + ), + folderSinkPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sinks/{sink}' + ), + logMetricPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metrics/{metric}' + ), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/cmekSettings' + ), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/exclusions/{exclusion}' + ), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}' + ), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' + ), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' + ), + organizationLogPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/logs/{log}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/settings' + ), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sinks/{sink}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/cmekSettings' + ), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/exclusions/{exclusion}' + ), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}' + ), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' + ), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' + ), + projectLogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/logs/{log}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/settings' + ), + projectSinkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sinks/{sink}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogMetrics: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.metricsServiceV2Stub) { + return this.metricsServiceV2Stub; + } + + // Put together the "service stub" for + // google.logging.v2.MetricsServiceV2. + this.metricsServiceV2Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.logging.v2.MetricsServiceV2, + 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 metricsServiceV2StubMethods = + ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; + for (const methodName of metricsServiceV2StubMethods) { + const callPromise = this.metricsServiceV2Stub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.metricsServiceV2Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'logging.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 'logging.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/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write' + ]; + } + + 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 -- + // ------------------- +/** + * Gets a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the desired metric: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async + */ + getLogMetric( + request?: protos.google.logging.v2.IGetLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined + ]>; + getLogMetric( + request: protos.google.logging.v2.IGetLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): void; + getLogMetric( + request: protos.google.logging.v2.IGetLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): void; + getLogMetric( + request?: protos.google.logging.v2.IGetLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLogMetric(request, options, callback); + } +/** + * Creates a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project in which to create the metric: + * + * "projects/[PROJECT_ID]" + * + * The new metric must be provided in the request. + * @param {google.logging.v2.LogMetric} request.metric + * Required. The new logs-based metric, which must not have an identifier that + * already exists. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async + */ + createLogMetric( + request?: protos.google.logging.v2.ICreateLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined + ]>; + createLogMetric( + request: protos.google.logging.v2.ICreateLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + createLogMetric( + request: protos.google.logging.v2.ICreateLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + createLogMetric( + request?: protos.google.logging.v2.ICreateLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createLogMetric(request, options, callback); + } +/** + * Creates or updates a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the metric to update: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * + * The updated metric must be provided in the request and it's + * `name` field must be the same as `[METRIC_ID]` If the metric + * does not exist in `[PROJECT_ID]`, then a new metric is created. + * @param {google.logging.v2.LogMetric} request.metric + * Required. The updated metric. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async + */ + updateLogMetric( + request?: protos.google.logging.v2.IUpdateLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined + ]>; + updateLogMetric( + request: protos.google.logging.v2.IUpdateLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + updateLogMetric( + request: protos.google.logging.v2.IUpdateLogMetricRequest, + callback: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): void; + updateLogMetric( + request?: protos.google.logging.v2.IUpdateLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateLogMetric(request, options, callback); + } +/** + * Deletes a logs-based metric. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.metricName + * Required. The resource name of the metric to delete: + * + * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js + * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async + */ + deleteLogMetric( + request?: protos.google.logging.v2.IDeleteLogMetricRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined + ]>; + deleteLogMetric( + request: protos.google.logging.v2.IDeleteLogMetricRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): void; + deleteLogMetric( + request: protos.google.logging.v2.IDeleteLogMetricRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): void; + deleteLogMetric( + request?: protos.google.logging.v2.IDeleteLogMetricRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metric_name': request.metricName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteLogMetric(request, options, callback); + } + + /** + * Lists logs-based metrics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLogMetricsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogMetrics( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + Promise<[ + protos.google.logging.v2.ILogMetric[], + protos.google.logging.v2.IListLogMetricsRequest|null, + protos.google.logging.v2.IListLogMetricsResponse + ]>; + listLogMetrics( + request: protos.google.logging.v2.IListLogMetricsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): void; + listLogMetrics( + request: protos.google.logging.v2.IListLogMetricsRequest, + callback: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): void; + listLogMetrics( + request?: protos.google.logging.v2.IListLogMetricsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>, + callback?: PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse|null|undefined, + protos.google.logging.v2.ILogMetric>): + Promise<[ + protos.google.logging.v2.ILogMetric[], + protos.google.logging.v2.IListLogMetricsRequest|null, + protos.google.logging.v2.IListLogMetricsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLogMetrics(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogMetric|LogMetric} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogMetricsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogMetricsStream( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.createStream( + this.innerApiCalls.listLogMetrics as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listLogMetrics`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogMetric|LogMetric}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.list_log_metrics.js + * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async + */ + listLogMetricsAsync( + request?: protos.google.logging.v2.IListLogMetricsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.asyncIterate( + this.innerApiCalls['listLogMetrics'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount:string,exclusion:string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount:string,log:string) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName: string) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount:string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount:string,sink:string) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder:string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder:string,exclusion:string) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName: string) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder:string,location:string,bucket:string) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder:string,log:string) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName: string) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder:string) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName: string) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder:string,sink:string) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; + } + + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName: string) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project:string,metric:string) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; + } + + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName: string) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization:string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization:string,exclusion:string) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization:string,location:string,bucket:string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization:string,log:string) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName: string) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization:string,sink:string) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName: string) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project:string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project:string,exclusion:string) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName: string) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project:string,location:string,bucket:string) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project:string,log:string) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; + } + + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName: string) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project:string,sink:string) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; + } + + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName: string) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; + } + + /** + * 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.metricsServiceV2Stub && !this._terminated) { + return this.metricsServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json new file mode 100644 index 00000000..014688ab --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.logging.v2.MetricsServiceV2": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "ListLogMetrics": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "CreateLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteLogMetric": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json new file mode 100644 index 00000000..fd41d3bf --- /dev/null +++ b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/logging/type/http_request.proto", + "../../protos/google/logging/type/log_severity.proto", + "../../protos/google/logging/v2/log_entry.proto", + "../../protos/google/logging/v2/logging.proto", + "../../protos/google/logging/v2/logging_config.proto", + "../../protos/google/logging/v2/logging_metrics.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 00000000..e3fe4bd9 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,29 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const logging = require('@google-cloud/logging'); + +function main() { + const configServiceV2Client = new logging.ConfigServiceV2Client(); + const loggingServiceV2Client = new logging.LoggingServiceV2Client(); + const metricsServiceV2Client = new logging.MetricsServiceV2Client(); +} + +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 00000000..a8f19533 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,44 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from '@google-cloud/logging'; + +// check that the client class type name can be used +function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { + client.close(); +} +function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { + client.close(); +} +function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const configServiceV2Client = new ConfigServiceV2Client(); + doStuffWithConfigServiceV2Client(configServiceV2Client); + // check that the client instance can be created + const loggingServiceV2Client = new LoggingServiceV2Client(); + doStuffWithLoggingServiceV2Client(loggingServiceV2Client); + // check that the client instance can be created + const metricsServiceV2Client = new MetricsServiceV2Client(); + doStuffWithMetricsServiceV2Client(metricsServiceV2Client); +} + +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 00000000..c8f81b25 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts new file mode 100644 index 00000000..1d67fad1 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts @@ -0,0 +1,6220 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as configservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ConfigServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = configservicev2Module.v2.ConfigServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.configServiceV2Stub, undefined); + await client.initialize(); + assert(client.configServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.configServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.configServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + 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 configservicev2Module.v2.ConfigServiceV2Client({ + 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('getBucket', () => { + it('invokes getBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); + const [response] = await client.getBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBucket(request), expectedError); + }); + }); + + describe('createBucket', () => { + it('invokes createBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); + const [response] = await client.createBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBucket(request), expectedError); + }); + }); + + describe('updateBucket', () => { + it('invokes updateBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); + const [response] = await client.updateBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogBucket() + ); + client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBucket( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBucket(request), expectedError); + }); + }); + + describe('deleteBucket', () => { + it('invokes deleteBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBucket( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBucket(request), expectedError); + }); + }); + + describe('undeleteBucket', () => { + it('invokes undeleteBucket without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); + const [response] = await client.undeleteBucket(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeleteBucket( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.undeleteBucket(request), expectedError); + const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeleteBucket with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UndeleteBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.undeleteBucket(request), expectedError); + }); + }); + + describe('getView', () => { + it('invokes getView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.getView = stubSimpleCall(expectedResponse); + const [response] = await client.getView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getView(request), expectedError); + const actualRequest = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getView(request), expectedError); + }); + }); + + describe('createView', () => { + it('invokes createView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.createView = stubSimpleCall(expectedResponse); + const [response] = await client.createView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createView(request), expectedError); + const actualRequest = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createView(request), expectedError); + }); + }); + + describe('updateView', () => { + it('invokes updateView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); + const [response] = await client.updateView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogView() + ); + client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateView( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateView(request), expectedError); + const actualRequest = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateView(request), expectedError); + }); + }); + + describe('deleteView', () => { + it('invokes deleteView without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); + const [response] = await client.deleteView(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteView( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteView(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteView with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteViewRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteView(request), expectedError); + }); + }); + + describe('getSink', () => { + it('invokes getSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); + const [response] = await client.getSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSink(request), expectedError); + const actualRequest = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSink(request), expectedError); + }); + }); + + describe('createSink', () => { + it('invokes createSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); + const [response] = await client.createSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSink(request), expectedError); + const actualRequest = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSink(request), expectedError); + }); + }); + + describe('updateSink', () => { + it('invokes updateSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); + const [response] = await client.updateSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogSink() + ); + client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSink(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSink(request), expectedError); + }); + }); + + describe('deleteSink', () => { + it('invokes deleteSink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSink( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSink(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteSinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); + request.sinkName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSink(request), expectedError); + }); + }); + + describe('getLink', () => { + it('invokes getLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Link() + ); + client.innerApiCalls.getLink = stubSimpleCall(expectedResponse); + const [response] = await client.getLink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Link() + ); + client.innerApiCalls.getLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLink( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLink(request), expectedError); + const actualRequest = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLink with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLink(request), expectedError); + }); + }); + + describe('getExclusion', () => { + it('invokes getExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.getExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExclusion(request), expectedError); + }); + }); + + describe('createExclusion', () => { + it('invokes createExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.createExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExclusion(request), expectedError); + }); + }); + + describe('updateExclusion', () => { + it('invokes updateExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.updateExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogExclusion() + ); + client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExclusion( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateExclusion(request), expectedError); + }); + }); + + describe('deleteExclusion', () => { + it('invokes deleteExclusion without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteExclusion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteExclusion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteExclusion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteExclusion with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteExclusionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteExclusion(request), expectedError); + }); + }); + + describe('getCmekSettings', () => { + it('invokes getCmekSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getCmekSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCmekSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCmekSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCmekSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCmekSettings(request), expectedError); + }); + }); + + describe('updateCmekSettings', () => { + it('invokes updateCmekSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateCmekSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.CmekSettings() + ); + client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCmekSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCmekSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCmekSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateCmekSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCmekSettings(request), expectedError); + }); + }); + + describe('getSettings', () => { + it('invokes getSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSettings(request), expectedError); + }); + }); + + describe('updateSettings', () => { + it('invokes updateSettings without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.Settings() + ); + client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSettings( + request, + (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with closed client', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSettings(request), expectedError); + }); + }); + + describe('createBucketAsync', () => { + it('invokes createBucketAsync without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBucketAsync(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBucketAsync = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBucketAsync( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBucketAsync(request), expectedError); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBucketAsync with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBucketAsync(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBucketAsyncProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBucketAsyncProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBucketAsyncProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBucketAsyncProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBucketAsync', () => { + it('invokes updateBucketAsync without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBucketAsync(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateBucketAsync = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBucketAsync( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBucketAsync(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBucketAsync with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateBucketRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBucketAsync(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateBucketAsyncProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateBucketAsyncProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBucketAsyncProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateBucketAsyncProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createLink', () => { + it('invokes createLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createLink = stubLongRunningCall(expectedResponse); + const [operation] = await client.createLink(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createLink = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createLink( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLink = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createLink(request), expectedError); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLink with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLink = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createLink(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateLinkProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateLinkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateLinkProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateLinkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteLink', () => { + it('invokes deleteLink without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteLink = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteLink(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteLink = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLink( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteLink(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLink with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLinkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteLink(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteLinkProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteLinkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteLinkProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteLinkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('copyLogEntries', () => { + it('invokes copyLogEntries without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); + const [operation] = await client.copyLogEntries(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes copyLogEntries without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.copyLogEntries( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes copyLogEntries with call error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.copyLogEntries(request), expectedError); + }); + + it('invokes copyLogEntries with LRO error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CopyLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.copyLogEntries(request); + await assert.rejects(operation.promise(), expectedError); + }); + + it('invokes checkCopyLogEntriesProgress without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCopyLogEntriesProgress with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBuckets', () => { + it('invokes listBuckets without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); + const [response] = await client.listBuckets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuckets without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuckets( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuckets with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuckets(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBucketsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBucketsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogBucket[] = []; + stream.on('data', (response: protos.google.logging.v2.LogBucket) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); + assert( + (client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBucketsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBucketsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogBucket[] = []; + stream.on('data', (response: protos.google.logging.v2.LogBucket) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); + assert( + (client.descriptors.page.listBuckets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuckets without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + generateSampleMessage(new protos.google.logging.v2.LogBucket()), + ]; + client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogBucket[] = []; + const iterable = client.listBucketsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuckets with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListBucketsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBucketsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogBucket[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuckets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listViews', () => { + it('invokes listViews without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); + const [response] = await client.listViews(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViews without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listViews( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViews with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listViews(request), expectedError); + const actualRequest = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listViewsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listViewsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogView[] = []; + stream.on('data', (response: protos.google.logging.v2.LogView) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listViews, request)); + assert( + (client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listViewsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listViewsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogView[] = []; + stream.on('data', (response: protos.google.logging.v2.LogView) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listViews, request)); + assert( + (client.descriptors.page.listViews.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listViews without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + generateSampleMessage(new protos.google.logging.v2.LogView()), + ]; + client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogView[] = []; + const iterable = client.listViewsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listViews with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListViewsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listViewsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogView[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listViews.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSinks', () => { + it('invokes listSinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); + const [response] = await client.listSinks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinks without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSinks( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSinks(request), expectedError); + const actualRequest = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSinksStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogSink[] = []; + stream.on('data', (response: protos.google.logging.v2.LogSink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); + assert( + (client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSinksStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogSink[] = []; + stream.on('data', (response: protos.google.logging.v2.LogSink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); + assert( + (client.descriptors.page.listSinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + generateSampleMessage(new protos.google.logging.v2.LogSink()), + ]; + client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogSink[] = []; + const iterable = client.listSinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListSinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogSink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listLinks', () => { + it('invokes listLinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.innerApiCalls.listLinks = stubSimpleCall(expectedResponse); + const [response] = await client.listLinks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinks without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.innerApiCalls.listLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLinks( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLinks(request), expectedError); + const actualRequest = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLinksStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.descriptors.page.listLinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.Link[] = []; + stream.on('data', (response: protos.google.logging.v2.Link) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); + assert( + (client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLinksStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.Link[] = []; + stream.on('data', (response: protos.google.logging.v2.Link) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); + assert( + (client.descriptors.page.listLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLinks without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + generateSampleMessage(new protos.google.logging.v2.Link()), + ]; + client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILink[] = []; + const iterable = client.listLinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLinks with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLinksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listExclusions', () => { + it('invokes listExclusions without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); + const [response] = await client.listExclusions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusions without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExclusions( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusions with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExclusions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExclusionsStream without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExclusionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogExclusion[] = []; + stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); + assert( + (client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExclusionsStream with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExclusionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogExclusion[] = []; + stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); + assert( + (client.descriptors.page.listExclusions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExclusions without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + generateSampleMessage(new protos.google.logging.v2.LogExclusion()), + ]; + client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogExclusion[] = []; + const iterable = client.listExclusionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExclusions with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListExclusionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExclusionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogExclusion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExclusions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new configservicev2Module.v2.ConfigServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts new file mode 100644 index 00000000..268928df --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts @@ -0,0 +1,2415 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as loggingservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubBidiStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.LoggingServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.loggingServiceV2Stub, undefined); + await client.initialize(); + assert(client.loggingServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.loggingServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.loggingServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + 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 loggingservicev2Module.v2.LoggingServiceV2Client({ + 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('deleteLog', () => { + it('invokes deleteLog without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); + const [response] = await client.deleteLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLog( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteLog(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLog with closed client', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); + request.logName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteLog(request), expectedError); + }); + }); + + describe('writeLogEntries', () => { + it('invokes writeLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesResponse() + ); + client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); + const [response] = await client.writeLogEntries(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes writeLogEntries without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesResponse() + ); + client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.writeLogEntries( + request, + (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes writeLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.writeLogEntries(request), expectedError); + }); + + it('invokes writeLogEntries with closed client', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.WriteLogEntriesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.writeLogEntries(request), expectedError); + }); + }); + + describe('tailLogEntries', () => { + it('invokes tailLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesResponse() + ); + client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); + const stream = client.tailLogEntries(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.tailLogEntries as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes tailLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.TailLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); + const stream = client.tailLogEntries(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.tailLogEntries as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + describe('listLogEntries', () => { + it('invokes listLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); + const [response] = await client.listLogEntries(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listLogEntries without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogEntries( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogEntries(request), expectedError); + }); + + it('invokes listLogEntriesStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogEntriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogEntry[] = []; + stream.on('data', (response: protos.google.logging.v2.LogEntry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogEntries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); + }); + + it('invokes listLogEntriesStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogEntriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogEntry[] = []; + stream.on('data', (response: protos.google.logging.v2.LogEntry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogEntries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); + }); + + it('uses async iteration with listLogEntries without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + generateSampleMessage(new protos.google.logging.v2.LogEntry()), + ]; + client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogEntry[] = []; + const iterable = client.listLogEntriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listLogEntries with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogEntriesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogEntriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogEntry[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listMonitoredResourceDescriptors', () => { + it('invokes listMonitoredResourceDescriptors without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); + const [response] = await client.listMonitoredResourceDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listMonitoredResourceDescriptors without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMonitoredResourceDescriptors( + request, + (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listMonitoredResourceDescriptors with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); + }); + + it('invokes listMonitoredResourceDescriptorsStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); + }); + + it('invokes listMonitoredResourceDescriptorsStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); + }); + + it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listLogs', () => { + it('invokes listLogs without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); + const [response] = await client.listLogs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogs without error using callback', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogs( + request, + (err?: Error|null, result?: string[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogs with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogs(request), expectedError); + const actualRequest = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogsStream without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); + assert( + (client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLogsStream with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); + assert( + (client.descriptors.page.listLogs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogs without error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.listLogsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogs with error', async () => { + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts new file mode 100644 index 00000000..6904bceb --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts @@ -0,0 +1,2257 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as metricsservicev2Module from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.MetricsServiceV2Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsServiceV2Stub, undefined); + await client.initialize(); + assert(client.metricsServiceV2Stub); + }); + + it('has close method for the initialized client', done => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.metricsServiceV2Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsServiceV2Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + 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 metricsservicev2Module.v2.MetricsServiceV2Client({ + 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('getLogMetric', () => { + it('invokes getLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.getLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.GetLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLogMetric(request), expectedError); + }); + }); + + describe('createLogMetric', () => { + it('invokes createLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.createLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.CreateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createLogMetric(request), expectedError); + }); + }); + + describe('updateLogMetric', () => { + it('invokes updateLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.updateLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.logging.v2.LogMetric() + ); + client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateLogMetric( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.UpdateLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateLogMetric(request), expectedError); + }); + }); + + describe('deleteLogMetric', () => { + it('invokes deleteLogMetric without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); + const [response] = await client.deleteLogMetric(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLogMetric( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteLogMetric(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteLogMetric with closed client', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.DeleteLogMetricRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); + request.metricName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteLogMetric(request), expectedError); + }); + }); + + describe('listLogMetrics', () => { + it('invokes listLogMetrics without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); + const [response] = await client.listLogMetrics(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetrics without error using callback', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLogMetrics( + request, + (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetrics with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLogMetrics(request), expectedError); + const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLogMetricsStream without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listLogMetricsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogMetric[] = []; + stream.on('data', (response: protos.google.logging.v2.LogMetric) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); + assert( + (client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listLogMetricsStream with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listLogMetricsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.logging.v2.LogMetric[] = []; + stream.on('data', (response: protos.google.logging.v2.LogMetric) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); + assert( + (client.descriptors.page.listLogMetrics.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogMetrics without error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + generateSampleMessage(new protos.google.logging.v2.LogMetric()), + ]; + client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.logging.v2.ILogMetric[] = []; + const iterable = client.listLogMetricsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listLogMetrics with error', async () => { + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.logging.v2.ListLogMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLogMetricsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.logging.v2.ILogMetric[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('billingAccountCmekSettings', () => { + const fakePath = "/rendered/path/billingAccountCmekSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountCmekSettingsPath', () => { + const result = client.billingAccountCmekSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountExclusion', () => { + const fakePath = "/rendered/path/billingAccountExclusion"; + const expectedParameters = { + billing_account: "billingAccountValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountExclusionPath', () => { + const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountExclusionName', () => { + const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromBillingAccountExclusionName', () => { + const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucket', () => { + const fakePath = "/rendered/path/billingAccountLocationBucket"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketPath', () => { + const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketLink', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketLink"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketLinkPath', () => { + const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromBillingAccountLocationBucketLinkName', () => { + const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLocationBucketView', () => { + const fakePath = "/rendered/path/billingAccountLocationBucketView"; + const expectedParameters = { + billing_account: "billingAccountValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLocationBucketViewPath', () => { + const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBillingAccountLocationBucketViewName', () => { + const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromBillingAccountLocationBucketViewName', () => { + const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromBillingAccountLocationBucketViewName', () => { + const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountLog', () => { + const fakePath = "/rendered/path/billingAccountLog"; + const expectedParameters = { + billing_account: "billingAccountValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountLogPath', () => { + const result = client.billingAccountLogPath("billingAccountValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountLogName', () => { + const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromBillingAccountLogName', () => { + const result = client.matchLogFromBillingAccountLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSettings', () => { + const fakePath = "/rendered/path/billingAccountSettings"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSettingsPath', () => { + const result = client.billingAccountSettingsPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSettingsName', () => { + const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('billingAccountSink', () => { + const fakePath = "/rendered/path/billingAccountSink"; + const expectedParameters = { + billing_account: "billingAccountValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountSinkPath', () => { + const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountSinkName', () => { + const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromBillingAccountSinkName', () => { + const result = client.matchSinkFromBillingAccountSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderCmekSettings', () => { + const fakePath = "/rendered/path/folderCmekSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderCmekSettingsPath', () => { + const result = client.folderCmekSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderCmekSettingsName', () => { + const result = client.matchFolderFromFolderCmekSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExclusion', () => { + const fakePath = "/rendered/path/folderExclusion"; + const expectedParameters = { + folder: "folderValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExclusionPath', () => { + const result = client.folderExclusionPath("folderValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExclusionName', () => { + const result = client.matchFolderFromFolderExclusionName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromFolderExclusionName', () => { + const result = client.matchExclusionFromFolderExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucket', () => { + const fakePath = "/rendered/path/folderLocationBucket"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketPath', () => { + const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketName', () => { + const result = client.matchFolderFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketName', () => { + const result = client.matchLocationFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketName', () => { + const result = client.matchBucketFromFolderLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketLink', () => { + const fakePath = "/rendered/path/folderLocationBucketLink"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketLinkPath', () => { + const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketLinkName', () => { + const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketLinkName', () => { + const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketLinkName', () => { + const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromFolderLocationBucketLinkName', () => { + const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLocationBucketView', () => { + const fakePath = "/rendered/path/folderLocationBucketView"; + const expectedParameters = { + folder: "folderValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationBucketViewPath', () => { + const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLocationBucketViewName', () => { + const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFolderLocationBucketViewName', () => { + const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromFolderLocationBucketViewName', () => { + const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromFolderLocationBucketViewName', () => { + const result = client.matchViewFromFolderLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderLog', () => { + const fakePath = "/rendered/path/folderLog"; + const expectedParameters = { + folder: "folderValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLogPath', () => { + const result = client.folderLogPath("folderValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderLogName', () => { + const result = client.matchFolderFromFolderLogName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromFolderLogName', () => { + const result = client.matchLogFromFolderLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSettings', () => { + const fakePath = "/rendered/path/folderSettings"; + const expectedParameters = { + folder: "folderValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSettingsPath', () => { + const result = client.folderSettingsPath("folderValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSettingsName', () => { + const result = client.matchFolderFromFolderSettingsName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSink', () => { + const fakePath = "/rendered/path/folderSink"; + const expectedParameters = { + folder: "folderValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSinkPath', () => { + const result = client.folderSinkPath("folderValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSinkName', () => { + const result = client.matchFolderFromFolderSinkName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromFolderSinkName', () => { + const result = client.matchSinkFromFolderSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('logMetric', () => { + const fakePath = "/rendered/path/logMetric"; + const expectedParameters = { + project: "projectValue", + metric: "metricValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.logMetricPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.logMetricPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('logMetricPath', () => { + const result = client.logMetricPath("projectValue", "metricValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLogMetricName', () => { + const result = client.matchProjectFromLogMetricName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetricFromLogMetricName', () => { + const result = client.matchMetricFromLogMetricName(fakePath); + assert.strictEqual(result, "metricValue"); + assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationCmekSettings', () => { + const fakePath = "/rendered/path/organizationCmekSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationCmekSettingsPath', () => { + const result = client.organizationCmekSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationCmekSettingsName', () => { + const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExclusion', () => { + const fakePath = "/rendered/path/organizationExclusion"; + const expectedParameters = { + organization: "organizationValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExclusionPath', () => { + const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExclusionName', () => { + const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromOrganizationExclusionName', () => { + const result = client.matchExclusionFromOrganizationExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucket', () => { + const fakePath = "/rendered/path/organizationLocationBucket"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketPath', () => { + const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketName', () => { + const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketName', () => { + const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketLink', () => { + const fakePath = "/rendered/path/organizationLocationBucketLink"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketLinkPath', () => { + const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketLinkName', () => { + const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromOrganizationLocationBucketLinkName', () => { + const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationBucketView', () => { + const fakePath = "/rendered/path/organizationLocationBucketView"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationBucketViewPath', () => { + const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationBucketViewName', () => { + const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationBucketViewName', () => { + const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromOrganizationLocationBucketViewName', () => { + const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromOrganizationLocationBucketViewName', () => { + const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLog', () => { + const fakePath = "/rendered/path/organizationLog"; + const expectedParameters = { + organization: "organizationValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLogPath', () => { + const result = client.organizationLogPath("organizationValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLogName', () => { + const result = client.matchOrganizationFromOrganizationLogName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromOrganizationLogName', () => { + const result = client.matchLogFromOrganizationLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSink', () => { + const fakePath = "/rendered/path/organizationSink"; + const expectedParameters = { + organization: "organizationValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSinkPath', () => { + const result = client.organizationSinkPath("organizationValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSinkName', () => { + const result = client.matchOrganizationFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromOrganizationSinkName', () => { + const result = client.matchSinkFromOrganizationSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCmekSettings', () => { + const fakePath = "/rendered/path/projectCmekSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCmekSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCmekSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCmekSettingsPath', () => { + const result = client.projectCmekSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCmekSettingsName', () => { + const result = client.matchProjectFromProjectCmekSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExclusion', () => { + const fakePath = "/rendered/path/projectExclusion"; + const expectedParameters = { + project: "projectValue", + exclusion: "exclusionValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExclusionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExclusionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExclusionPath', () => { + const result = client.projectExclusionPath("projectValue", "exclusionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExclusionName', () => { + const result = client.matchProjectFromProjectExclusionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExclusionFromProjectExclusionName', () => { + const result = client.matchExclusionFromProjectExclusionName(fakePath); + assert.strictEqual(result, "exclusionValue"); + assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucket', () => { + const fakePath = "/rendered/path/projectLocationBucket"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketPath', () => { + const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketName', () => { + const result = client.matchProjectFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketName', () => { + const result = client.matchLocationFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketName', () => { + const result = client.matchBucketFromProjectLocationBucketName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketLink', () => { + const fakePath = "/rendered/path/projectLocationBucketLink"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + link: "linkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketLinkPath', () => { + const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketLinkName', () => { + const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketLinkName', () => { + const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketLinkName', () => { + const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLinkFromProjectLocationBucketLinkName', () => { + const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); + assert.strictEqual(result, "linkValue"); + assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBucketView', () => { + const fakePath = "/rendered/path/projectLocationBucketView"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + bucket: "bucketValue", + view: "viewValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBucketViewPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBucketViewPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBucketViewPath', () => { + const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBucketViewName', () => { + const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBucketViewName', () => { + const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBucketFromProjectLocationBucketViewName', () => { + const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "bucketValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchViewFromProjectLocationBucketViewName', () => { + const result = client.matchViewFromProjectLocationBucketViewName(fakePath); + assert.strictEqual(result, "viewValue"); + assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLog', () => { + const fakePath = "/rendered/path/projectLog"; + const expectedParameters = { + project: "projectValue", + log: "logValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLogPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLogPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLogPath', () => { + const result = client.projectLogPath("projectValue", "logValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLogName', () => { + const result = client.matchProjectFromProjectLogName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLogFromProjectLogName', () => { + const result = client.matchLogFromProjectLogName(fakePath); + assert.strictEqual(result, "logValue"); + assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSink', () => { + const fakePath = "/rendered/path/projectSink"; + const expectedParameters = { + project: "projectValue", + sink: "sinkValue", + }; + const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSinkPath', () => { + const result = client.projectSinkPath("projectValue", "sinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSinkName', () => { + const result = client.matchProjectFromProjectSinkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSinkFromProjectSinkName', () => { + const result = client.matchSinkFromProjectSinkName(fakePath); + assert.strictEqual(result, "sinkValue"); + assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /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 00000000..a37e80e5 --- /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: 'logging', + filename: './logging.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 a19a96494bb844528bfd5d204f3be541e8e7ac19 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 26 Sep 2023 22:55:59 +0000 Subject: [PATCH 4/5] =?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/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/package.json | 60 - .../protos/google/logging/v2/log_entry.proto | 280 - .../v2/protos/google/logging/v2/logging.proto | 483 -- .../google/logging/v2/logging_config.proto | 2317 ------ .../google/logging/v2/logging_metrics.proto | 339 - .../v2/config_service_v2.copy_log_entries.js | 74 - .../v2/config_service_v2.create_bucket.js | 78 - .../config_service_v2.create_bucket_async.js | 79 - .../v2/config_service_v2.create_exclusion.js | 74 - .../v2/config_service_v2.create_link.js | 78 - .../v2/config_service_v2.create_sink.js | 88 - .../v2/config_service_v2.create_view.js | 76 - .../v2/config_service_v2.delete_bucket.js | 67 - .../v2/config_service_v2.delete_exclusion.js | 67 - .../v2/config_service_v2.delete_link.js | 66 - .../v2/config_service_v2.delete_sink.js | 68 - .../v2/config_service_v2.delete_view.js | 64 - .../v2/config_service_v2.get_bucket.js | 67 - .../v2/config_service_v2.get_cmek_settings.js | 71 - .../v2/config_service_v2.get_exclusion.js | 67 - .../v2/config_service_v2.get_link.js | 65 - .../v2/config_service_v2.get_settings.js | 71 - .../v2/config_service_v2.get_sink.js | 67 - .../v2/config_service_v2.get_view.js | 64 - .../v2/config_service_v2.list_buckets.js | 83 - .../v2/config_service_v2.list_exclusions.js | 80 - .../v2/config_service_v2.list_links.js | 77 - .../v2/config_service_v2.list_sinks.js | 80 - .../v2/config_service_v2.list_views.js | 77 - .../v2/config_service_v2.undelete_bucket.js | 67 - .../v2/config_service_v2.update_bucket.js | 82 - .../config_service_v2.update_bucket_async.js | 83 - .../config_service_v2.update_cmek_settings.js | 86 - .../v2/config_service_v2.update_exclusion.js | 84 - .../v2/config_service_v2.update_settings.js | 83 - .../v2/config_service_v2.update_sink.js | 101 - .../v2/config_service_v2.update_view.js | 78 - .../v2/logging_service_v2.delete_log.js | 70 - .../v2/logging_service_v2.list_log_entries.js | 106 - .../v2/logging_service_v2.list_logs.js | 94 - ..._v2.list_monitored_resource_descriptors.js | 71 - .../v2/logging_service_v2.tail_log_entries.js | 89 - .../logging_service_v2.write_log_entries.js | 129 - .../metrics_service_v2.create_log_metric.js | 69 - .../metrics_service_v2.delete_log_metric.js | 62 - .../v2/metrics_service_v2.get_log_metric.js | 62 - .../v2/metrics_service_v2.list_log_metrics.js | 77 - .../metrics_service_v2.update_log_metric.js | 70 - .../snippet_metadata_google.logging.v2.json | 1963 ------ owl-bot-staging/v2/src/index.ts | 29 - .../v2/src/v2/config_service_v2_client.ts | 5530 --------------- .../v2/config_service_v2_client_config.json | 169 - .../src/v2/config_service_v2_proto_list.json | 8 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 512 -- owl-bot-staging/v2/src/v2/index.ts | 21 - .../v2/src/v2/logging_service_v2_client.ts | 2754 -------- .../v2/logging_service_v2_client_config.json | 67 - .../src/v2/logging_service_v2_proto_list.json | 8 - .../v2/src/v2/metrics_service_v2_client.ts | 2288 ------ .../v2/metrics_service_v2_client_config.json | 56 - .../src/v2/metrics_service_v2_proto_list.json | 8 - .../system-test/fixtures/sample/src/index.js | 29 - .../system-test/fixtures/sample/src/index.ts | 44 - owl-bot-staging/v2/system-test/install.ts | 49 - .../v2/test/gapic_config_service_v2_v2.ts | 6220 ----------------- .../v2/test/gapic_logging_service_v2_v2.ts | 2415 ------- .../v2/test/gapic_metrics_service_v2_v2.ts | 2257 ------ owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 - 76 files changed, 31435 deletions(-) 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/package.json delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto delete mode 100644 owl-bot-staging/v2/protos/google/logging/v2/logging_metrics.proto delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json delete mode 100644 owl-bot-staging/v2/src/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json 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/logging_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/metrics_service_v2_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_config_service_v2_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_metrics_service_v2_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/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- 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 78215349..00000000 --- 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 d4f03a0d..00000000 --- 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 9e6e0612..00000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/logging', - 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 1a38f257..00000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js deleted file mode 100644 index 55639e70..00000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md deleted file mode 100644 index bdf6f36e..00000000 --- a/owl-bot-staging/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Logging: Nodejs Client diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index a6bd705c..00000000 --- a/owl-bot-staging/v2/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@google-cloud/logging", - "version": "0.1.0", - "description": "Logging client for Node.js", - "repository": "googleapis/nodejs-logging", - "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 logging", - "logging", - "config service v2", - "logging service v2", - "metrics service v2" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.4" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.17", - "c8": "^8.0.1", - "gapic-tools": "^0.2.0", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-fresh": "^3.0.0", - "jsdoc-region-tag": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto b/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto deleted file mode 100644 index 94c5cdff..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/log_entry.proto +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/type/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 cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// An individual entry in a log. -message LogEntry { - option (google.api.resource) = { - type: "logging.googleapis.com/Log" - pattern: "projects/{project}/logs/{log}" - pattern: "organizations/{organization}/logs/{log}" - pattern: "folders/{folder}/logs/{log}" - pattern: "billingAccounts/{billing_account}/logs/{log}" - name_field: "log_name" - }; - - // Required. The resource name of the log to which this log entry belongs: - // - // "projects/[PROJECT_ID]/logs/[LOG_ID]" - // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - // "folders/[FOLDER_ID]/logs/[LOG_ID]" - // - // A project number may be used in place of PROJECT_ID. The project number is - // translated to its corresponding PROJECT_ID internally and the `log_name` - // field will contain PROJECT_ID in queries and exports. - // - // `[LOG_ID]` must be URL-encoded within `log_name`. Example: - // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - // - // `[LOG_ID]` must be less than 512 characters long and can only include the - // following characters: upper and lower case alphanumeric characters, - // forward-slash, underscore, hyphen, and period. - // - // For backward compatibility, if `log_name` begins with a forward-slash, such - // as `/projects/...`, then the log entry is ingested as usual, but the - // forward-slash is removed. Listing the log entry will not show the leading - // slash and filtering for a log name with a leading slash will never return - // any results. - string log_name = 12 [(google.api.field_behavior) = REQUIRED]; - - // Required. The monitored resource that produced this log entry. - // - // Example: a log entry that reports a database error would be associated with - // the monitored resource designating the particular database that reported - // the error. - google.api.MonitoredResource resource = 8 - [(google.api.field_behavior) = REQUIRED]; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer. Some Google - // Cloud Platform services use this field for their log entry payloads. - // - // The following protocol buffer types are supported; user-defined types - // are not supported: - // - // "type.googleapis.com/google.cloud.audit.AuditLog" - // "type.googleapis.com/google.appengine.logging.v1.RequestLog" - 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 json_payload = 6; - } - - // Optional. The time the event described by the log entry occurred. This time - // is used to compute the log entry's age and to enforce the logs retention - // period. If this field is omitted in a new log entry, then Logging assigns - // it the current time. Timestamps have nanosecond accuracy, but trailing - // zeros in the fractional seconds might be omitted when the timestamp is - // displayed. - // - // Incoming log entries must have timestamps that don't exceed the - // [logs retention - // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in - // the past, and that don't exceed 24 hours in the future. Log entries outside - // those time boundaries aren't ingested by Logging. - google.protobuf.Timestamp timestamp = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time the log entry was received by Logging. - google.protobuf.Timestamp receive_timestamp = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The severity of the log entry. The default value is - // `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique identifier for the log entry. If you provide a value, - // then Logging considers other log entries in the same project, with the same - // `timestamp`, and with the same `insert_id` to be duplicates which are - // removed in a single query result. However, there are no guarantees of - // de-duplication in the export of logs. - // - // If the `insert_id` is omitted when writing a log entry, the Logging API - // assigns its own unique identifier in this field. - // - // In queries, the `insert_id` is also used to order log entries that have - // the same `log_name` and `timestamp` values. - string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about the HTTP request associated with this log - // entry, if applicable. - google.logging.type.HttpRequest http_request = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map of key, value pairs that provides additional information - // about the log entry. The labels can be user-defined or system-defined. - // - // User-defined labels are arbitrary key, value pairs that you can use to - // classify logs. - // - // System-defined labels are defined by GCP services for platform logs. - // They have two components - a service namespace component and the - // attribute name. For example: `compute.googleapis.com/resource_name`. - // - // Cloud Logging truncates label keys that exceed 512 B and label - // values that exceed 64 KB upon their associated log entry being - // written. The truncation is indicated by an ellipsis at the - // end of the character string. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about an operation associated with the log entry, if - // applicable. - LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The REST resource name of the trace being written to - // [Cloud Trace](https://cloud.google.com/trace) in - // association with this log entry. For example, if your trace data is stored - // in the Cloud project "my-trace-project" and if the service that is creating - // the log entry receives a trace header that includes the trace ID "12345", - // then the service should use "projects/my-tracing-project/traces/12345". - // - // The `trace` field provides the link between logs and traces. By using - // this field, you can navigate from a log entry to a trace. - string trace = 22 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span - // associated with the current operation in which the log is being written. - // For example, if a span has the REST resource name of - // "projects/some-project/traces/some-trace/spans/some-span-id", then the - // `span_id` field is "some-span-id". - // - // A - // [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span) - // represents a single operation within a trace. Whereas a trace may involve - // multiple different microservices running on multiple different machines, - // a span generally corresponds to a single logical operation being performed - // in a single instance of a microservice on one specific machine. Spans - // are the nodes within the tree that is a trace. - // - // Applications that are [instrumented for - // tracing](https://cloud.google.com/trace/docs/setup) will generally assign a - // new, unique span ID on each incoming request. It is also common to create - // and record additional spans corresponding to internal processing elements - // as well as issuing requests to dependencies. - // - // The span ID is expected to be a 16-character, hexadecimal encoding of an - // 8-byte array and should not be zero. It should be unique within the trace - // and should, ideally, be generated in a manner that is uniformly random. - // - // Example values: - // - // - `000000000000004a` - // - `7a2190356c3fc94b` - // - `0000f00300090021` - // - `d39223e101960076` - string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sampling decision of the trace associated with the log entry. - // - // True means that the trace resource name in the `trace` field was sampled - // for storage in a trace backend. False means that the trace was not sampled - // for storage when this log entry was written, or the sampling decision was - // unknown at the time. A non-sampled `trace` value is still useful as a - // request correlation identifier. The default is False. - bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Source code location information associated with the log entry, - // if any. - LogEntrySourceLocation source_location = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information indicating this LogEntry is part of a sequence of - // multiple log entries split from a single LogEntry. - LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; -} - -// 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 [(google.api.field_behavior) = OPTIONAL]; - - // 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 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the first log entry in the operation. - bool first = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the last log entry in the operation. - bool last = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// 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 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Line within the source file. 1-based; 0 indicates no line number - // available. - int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information used to correlate multiple log entries. Used when a -// single LogEntry would exceed the Google Cloud Logging size limit and is -// split across multiple log entries. -message LogSplit { - // A globally unique identifier for all log entries in a sequence of split log - // entries. All log entries with the same |LogSplit.uid| are assumed to be - // part of the same sequence of split log entries. - string uid = 1; - - // The index of this LogEntry in the sequence of split log entries. Log - // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log - // entries. - int32 index = 2; - - // The total number of log entries that the original LogEntry was split into. - int32 total_splits = 3; -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging.proto deleted file mode 100644 index 92d481ea..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/logging.proto +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/v2/log_entry.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// Service for ingesting and querying logs. -service LoggingServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read," - "https://www.googleapis.com/auth/logging.write"; - - // Deletes all the log entries in a log for the _Default Log Bucket. The log - // reappears if it receives new entries. Log entries written shortly before - // the delete operation might not be deleted. Entries received after the - // delete operation with a timestamp before the operation will be deleted. - rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{log_name=projects/*/logs/*}" - additional_bindings { delete: "/v2/{log_name=*/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=organizations/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=folders/*/logs/*}" } - additional_bindings { delete: "/v2/{log_name=billingAccounts/*/logs/*}" } - }; - option (google.api.method_signature) = "log_name"; - } - - // Writes log entries to Logging. This API method is the - // only way to send log entries to Logging. This method - // is used, directly or indirectly, by the Logging agent - // (fluentd) and all logging libraries configured to use Logging. - // A single request may contain log entries for a maximum of 1000 - // different resources (projects, organizations, billing accounts or - // folders) - rpc WriteLogEntries(WriteLogEntriesRequest) - returns (WriteLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:write" - body: "*" - }; - option (google.api.method_signature) = "log_name,resource,labels,entries"; - } - - // Lists log entries. Use this method to retrieve log entries that originated - // from a project/folder/organization/billing account. For ways to export log - // entries, see [Exporting - // Logs](https://cloud.google.com/logging/docs/export). - rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:list" - body: "*" - }; - option (google.api.method_signature) = "resource_names,filter,order_by"; - } - - // Lists the descriptors for monitored resource types used by Logging. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) - returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v2/monitoredResourceDescriptors" - }; - } - - // Lists the logs in projects, organizations, folders, or billing accounts. - // Only logs that have entries are listed. - rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/logs" - additional_bindings { get: "/v2/{parent=projects/*}/logs" } - additional_bindings { get: "/v2/{parent=organizations/*}/logs" } - additional_bindings { get: "/v2/{parent=folders/*}/logs" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/logs" } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Streaming read of log entries as they are ingested. Until the stream is - // terminated, it will continue reading logs. - rpc TailLogEntries(stream TailLogEntriesRequest) - returns (stream TailLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:tail" - body: "*" - }; - } -} - -// The parameters to DeleteLog. -message DeleteLogRequest { - // Required. The resource name of the log to delete: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example, - // `"projects/my-project-id/logs/syslog"`, - // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - // - // For more information about log names, see - // [LogEntry][google.logging.v2.LogEntry]. - string log_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } - ]; -} - -// The parameters to WriteLogEntries. -message WriteLogEntriesRequest { - // Optional. A default log resource name that is assigned to all log entries - // in `entries` that do not specify a value for `log_name`: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example: - // - // "projects/my-project-id/logs/syslog" - // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - // - // The permission `logging.logEntries.create` is needed on each project, - // organization, billing account, or folder that is receiving new log - // entries, whether the resource is specified in `logName` or in an - // individual log entry. - string log_name = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "logging.googleapis.com/Log" } - ]; - - // Optional. A default monitored resource object that is assigned to all log - // entries in `entries` that do not specify a value for `resource`. Example: - // - // { "type": "gce_instance", - // "labels": { - // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - // - // See [LogEntry][google.logging.v2.LogEntry]. - google.api.MonitoredResource resource = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Default labels that are added to the `labels` field of all log - // entries in `entries`. If a log entry already has a label with the same key - // as a label in this parameter, then the log entry's label is not changed. - // See [LogEntry][google.logging.v2.LogEntry]. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The log entries to send to Logging. The order of log - // entries in this list does not matter. Values supplied in this method's - // `log_name`, `resource`, and `labels` fields are copied into those log - // entries in this list that do not include values for their corresponding - // fields. For more information, see the - // [LogEntry][google.logging.v2.LogEntry] type. - // - // If the `timestamp` or `insert_id` fields are missing in log entries, then - // this method supplies the current time or a unique identifier, respectively. - // The supplied values are chosen so that, among the log entries that did not - // supply their own values, the entries earlier in the list will sort before - // the entries later in the list. See the `entries.list` method. - // - // Log entries with timestamps that are more than the - // [logs retention period](https://cloud.google.com/logging/quotas) in - // the past or more than 24 hours in the future will not be available when - // calling `entries.list`. However, those log entries can still be [exported - // with - // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - // - // To improve throughput and to avoid exceeding the - // [quota limit](https://cloud.google.com/logging/quotas) for calls to - // `entries.write`, you should try to include several log entries in this - // list, rather than calling this method for each individual log entry. - repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether a batch's valid entries should be written even if some - // other entry failed due to a permanent error such as INVALID_ARGUMENT or - // PERMISSION_DENIED. If any entry failed, then the response status is the - // response status of one of the failed entries. The response will include - // error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - // the entries' zero-based index in the `entries`. Failed requests for which - // no entries are written will not include per-entry errors. - bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the request should expect normal response, but the - // entries won't be persisted nor exported. Useful for checking whether the - // logging API endpoints are working properly before sending valuable data. - bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from WriteLogEntries. -message WriteLogEntriesResponse {} - -// Error details for WriteLogEntries with partial success. -message WriteLogEntriesPartialErrors { - // When `WriteLogEntriesRequest.partial_success` is true, records the error - // status for entries that were not written due to a permanent error, keyed - // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. - // - // Failed requests for which no entries are written will not include - // per-entry errors. - map log_entry_errors = 1; -} - -// The parameters to `ListLogEntries`. -message ListLogEntriesRequest { - // Required. Names of one or more parent resources from which to - // retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // Projects listed in the `project_ids` field are added to this list. - // A maximum of 100 resources may be specified in a single request. - repeated string resource_names = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. Only log entries that match the filter are returned. An empty - // filter matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of a filter is - // 20,000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. How the results should be sorted. Presently, the only permitted - // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - // option returns entries in order of increasing values of - // `LogEntry.timestamp` (oldest first), and the second option returns entries - // in order of decreasing timestamps (newest first). Entries with equal - // timestamps are returned in order of their `insert_id` values. - string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Default is 50. If the value is negative or exceeds 1000, the request is - // rejected. The presence of `next_page_token` in the response indicates that - // more results might be available. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `page_token` must be the value of - // `next_page_token` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListLogEntries`. -message ListLogEntriesResponse { - // A list of log entries. If `entries` is empty, `nextPageToken` may still be - // returned, indicating that more entries may exist. See `nextPageToken` for - // more information. - repeated LogEntry entries = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - // - // If a value for `next_page_token` appears and the `entries` field is empty, - // it means that the search found no log entries so far but it did not have - // time to search all the possible log entries. Retry the method with this - // value for `page_token` to continue the search. Alternatively, consider - // speeding up the search by changing your filter to specify a single log name - // or resource type, or to narrow the time range of the search. - string next_page_token = 2; -} - -// The parameters to ListMonitoredResourceDescriptors -message ListMonitoredResourceDescriptorsRequest { - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListMonitoredResourceDescriptors. -message ListMonitoredResourceDescriptorsResponse { - // A list of resource descriptors. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to ListLogs. -message ListLogsRequest { - // Required. The resource name to list logs for: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. List of resource names to list logs for: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // To support legacy queries, it could also be: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // The resource name in the `parent` field is added to this list. - repeated string resource_names = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogs. -message ListLogsResponse { - // A list of log names. For example, - // `"projects/my-project/logs/syslog"` or - // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - repeated string log_names = 3; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `TailLogEntries`. -message TailLogEntriesRequest { - // Required. Name of a parent resource from which to retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Only log entries that match the filter are returned. An empty - // filter matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of a filter is - // 20,000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The amount of time to buffer log entries at the server before - // being returned to prevent out of order results due to late arriving log - // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - // milliseconds. - google.protobuf.Duration buffer_window = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `TailLogEntries`. -message TailLogEntriesResponse { - // Information about entries that were omitted from the session. - message SuppressionInfo { - // An indicator of why entries were omitted. - enum Reason { - // Unexpected default. - REASON_UNSPECIFIED = 0; - - // Indicates suppression occurred due to relevant entries being - // received in excess of rate limits. For quotas and limits, see - // [Logging API quotas and - // limits](https://cloud.google.com/logging/quotas#api-limits). - RATE_LIMIT = 1; - - // Indicates suppression occurred due to the client not consuming - // responses quickly enough. - NOT_CONSUMED = 2; - } - - // The reason that entries were omitted from the session. - Reason reason = 1; - - // A lower bound on the count of entries omitted due to `reason`. - int32 suppressed_count = 2; - } - - // A list of log entries. Each response in the stream will order entries with - // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed - // between separate responses. - repeated LogEntry entries = 1; - - // If entries that otherwise would have been included in the session were not - // sent back to the client, counts of relevant entries omitted from the - // session with the reason that they were not included. There will be at most - // one of each reason per response. The counts represent the number of - // suppressed entries since the last streamed response. - repeated SuppressionInfo suppression_info = 2; -} diff --git a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto b/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto deleted file mode 100644 index cc7677b1..00000000 --- a/owl-bot-staging/v2/protos/google/logging/v2/logging_config.proto +++ /dev/null @@ -1,2317 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; -option java_multiple_files = true; -option java_outer_classname = "LoggingConfigProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/OrganizationLocation" - pattern: "organizations/{organization}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/FolderLocation" - pattern: "folders/{folder}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/BillingAccountLocation" - pattern: "billingAccounts/{billing_account}/locations/{location}" -}; - -// Service for configuring sinks used to route log entries. -service ConfigServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read"; - - // Lists log buckets. - rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*}/buckets" - additional_bindings { get: "/v2/{parent=projects/*/locations/*}/buckets" } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/buckets" - } - additional_bindings { get: "/v2/{parent=folders/*/locations/*}/buckets" } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a log bucket. - rpc GetBucket(GetBucketRequest) returns (LogBucket) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { get: "/v2/{name=projects/*/locations/*/buckets/*}" } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { get: "/v2/{name=folders/*/locations/*/buckets/*}" } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Creates a log bucket asynchronously that can be used to store log entries. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc CreateBucketAsync(CreateBucketRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets:createAsync" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets:createAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync" - body: "bucket" - } - }; - option (google.longrunning.operation_info) = { - response_type: "LogBucket" - metadata_type: "BucketMetadata" - }; - } - - // Updates a log bucket asynchronously. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucketAsync(UpdateBucketRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync" - body: "bucket" - } - }; - option (google.longrunning.operation_info) = { - response_type: "LogBucket" - metadata_type: "BucketMetadata" - }; - } - - // Creates a log bucket that can be used to store log entries. After a bucket - // has been created, the bucket's location cannot be changed. - rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - body: "bucket" - } - }; - } - - // Updates a log bucket. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*}" - body: "bucket" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - body: "bucket" - } - }; - } - - // Deletes a log bucket. - // - // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - // After 7 days, the bucket will be purged and all log entries in the bucket - // will be permanently deleted. - rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Undeletes a log bucket. A bucket that has been deleted can be undeleted - // within the grace period of 7 days. - rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" - body: "*" - } - }; - } - - // Lists views on a log bucket. - rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/views" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a view on a log bucket.. - rpc GetView(GetViewRequest) returns (LogView) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Creates a view over log entries in a log bucket. A bucket may contain a - // maximum of 30 views. - rpc CreateView(CreateViewRequest) returns (LogView) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/views" - body: "view" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - body: "view" - } - }; - } - - // Updates a view on a log bucket. This method replaces the following fields - // in the existing view with values from the new view: `filter`. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can update the view. If this occurs, please try again in a - // few minutes. - rpc UpdateView(UpdateViewRequest) returns (LogView) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - body: "view" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - body: "view" - } - }; - } - - // Deletes a view on a log bucket. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can delete the view. If this occurs, please try again in a - // few minutes. - rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Lists sinks. - rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/sinks" - additional_bindings { get: "/v2/{parent=projects/*}/sinks" } - additional_bindings { get: "/v2/{parent=organizations/*}/sinks" } - additional_bindings { get: "/v2/{parent=folders/*}/sinks" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/sinks" } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a sink. - rpc GetSink(GetSinkRequest) returns (LogSink) { - option (google.api.http) = { - get: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { get: "/v2/{sink_name=projects/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=organizations/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=folders/*/sinks/*}" } - additional_bindings { get: "/v2/{sink_name=billingAccounts/*/sinks/*}" } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Creates a sink that exports specified log entries to a destination. The - // export of newly-ingested log entries begins immediately, unless the sink's - // `writer_identity` is not permitted to write to the destination. A sink can - // export log entries only from the resource owning the sink. - rpc CreateSink(CreateSinkRequest) returns (LogSink) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/sinks" - body: "sink" - additional_bindings { post: "/v2/{parent=projects/*}/sinks" body: "sink" } - additional_bindings { - post: "/v2/{parent=organizations/*}/sinks" - body: "sink" - } - additional_bindings { post: "/v2/{parent=folders/*}/sinks" body: "sink" } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/sinks" - body: "sink" - } - }; - option (google.api.method_signature) = "parent,sink"; - } - - // Updates a sink. This method replaces the following fields in the existing - // sink with values from the new sink: `destination`, and `filter`. - // - // The updated sink might also have a new `writer_identity`; see the - // `unique_writer_identity` field. - rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { - option (google.api.http) = { - put: "/v2/{sink_name=*/*/sinks/*}" - body: "sink" - additional_bindings { - put: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - }; - option (google.api.method_signature) = "sink_name,sink,update_mask"; - option (google.api.method_signature) = "sink_name,sink"; - } - - // Deletes a sink. If the sink has a unique `writer_identity`, then that - // service account is also deleted. - rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { delete: "/v2/{sink_name=projects/*/sinks/*}" } - additional_bindings { delete: "/v2/{sink_name=organizations/*/sinks/*}" } - additional_bindings { delete: "/v2/{sink_name=folders/*/sinks/*}" } - additional_bindings { - delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Asynchronously creates a linked dataset in BigQuery which makes it possible - // to use BigQuery to read the logs stored in the log bucket. A log bucket may - // currently only contain one link. - rpc CreateLink(CreateLinkRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/links" - body: "link" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/links" - body: "link" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" - body: "link" - } - }; - option (google.api.method_signature) = "parent,link,link_id"; - option (google.longrunning.operation_info) = { - response_type: "Link" - metadata_type: "LinkMetadata" - }; - } - - // Deletes a link. This will also delete the corresponding BigQuery linked - // dataset. - rpc DeleteLink(DeleteLinkRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/links/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "LinkMetadata" - }; - } - - // Lists links. - rpc ListLinks(ListLinksRequest) returns (ListLinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/links" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/links" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a link. - rpc GetLink(GetLinkRequest) returns (Link) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/links/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists all the exclusions on the _Default sink in a parent resource. - rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/exclusions" - additional_bindings { get: "/v2/{parent=projects/*}/exclusions" } - additional_bindings { get: "/v2/{parent=organizations/*}/exclusions" } - additional_bindings { get: "/v2/{parent=folders/*}/exclusions" } - additional_bindings { get: "/v2/{parent=billingAccounts/*}/exclusions" } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the description of an exclusion in the _Default sink. - rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - get: "/v2/{name=*/*/exclusions/*}" - additional_bindings { get: "/v2/{name=projects/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=organizations/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=folders/*/exclusions/*}" } - additional_bindings { get: "/v2/{name=billingAccounts/*/exclusions/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new exclusion in the _Default sink in a specified parent - // resource. Only log entries belonging to that resource can be excluded. You - // can have up to 10 exclusions in a resource. - rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/exclusions" - body: "exclusion" - additional_bindings { - post: "/v2/{parent=projects/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=folders/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/exclusions" - body: "exclusion" - } - }; - option (google.api.method_signature) = "parent,exclusion"; - } - - // Changes one or more properties of an existing exclusion in the _Default - // sink. - rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - patch: "/v2/{name=*/*/exclusions/*}" - body: "exclusion" - additional_bindings { - patch: "/v2/{name=projects/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=organizations/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=folders/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/exclusions/*}" - body: "exclusion" - } - }; - option (google.api.method_signature) = "name,exclusion,update_mask"; - } - - // Deletes an exclusion in the _Default sink. - rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/exclusions/*}" - additional_bindings { delete: "/v2/{name=projects/*/exclusions/*}" } - additional_bindings { delete: "/v2/{name=organizations/*/exclusions/*}" } - additional_bindings { delete: "/v2/{name=folders/*/exclusions/*}" } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the Logging CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can be configured for Google Cloud projects, - // folders, organizations and billing accounts. Once configured for an - // organization, it applies to all projects and folders in the Google Cloud - // organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/cmekSettings" - additional_bindings { get: "/v2/{name=projects/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=organizations/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=folders/*}/cmekSettings" } - additional_bindings { get: "/v2/{name=billingAccounts/*}/cmekSettings" } - }; - } - - // Updates the Log Router CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can currently only be configured for Google - // Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/cmekSettings" - body: "cmek_settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/cmekSettings" - body: "cmek_settings" - } - }; - } - - // Gets the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can be get for Google Cloud projects, - // folders, organizations and billing accounts. Currently it can only be - // configured for organizations. Once configured for an organization, it - // applies to all projects and folders in the Google Cloud organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/settings" - additional_bindings { get: "/v2/{name=projects/*}/settings" } - additional_bindings { get: "/v2/{name=organizations/*}/settings" } - additional_bindings { get: "/v2/{name=folders/*}/settings" } - additional_bindings { get: "/v2/{name=billingAccounts/*}/settings" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can currently only be configured for - // Google Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. 4) `location_id` is not supported by - // Logging. 5) `location_id` violate OrgPolicy. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/settings" - body: "settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/settings" - body: "settings" - } - additional_bindings { - patch: "/v2/{name=folders/*}/settings" - body: "settings" - } - }; - option (google.api.method_signature) = "settings,update_mask"; - } - - // Copies a set of log entries from a log bucket to a Cloud Storage bucket. - rpc CopyLogEntries(CopyLogEntriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/entries:copy" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "CopyLogEntriesResponse" - metadata_type: "CopyLogEntriesMetadata" - }; - } -} - -// Configuration for an indexed field. -message IndexConfig { - // Required. The LogEntry field path to index. - // - // Note that some paths are automatically indexed, and other paths are not - // eligible for indexing. See [indexing documentation]( - // https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields) - // for details. - // - // For example: `jsonPayload.request.status` - string field_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of data in this index. - IndexType type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The timestamp when the index was last modified. - // - // This is used to return the timestamp, and will be ignored if supplied - // during update. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a repository in which log entries are stored. -message LogBucket { - option (google.api.resource) = { - type: "logging.googleapis.com/LogBucket" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" - }; - - // Output only. The resource name of the bucket. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // For a list of supported locations, see [Supported - // Regions](https://cloud.google.com/logging/docs/region-support) - // - // For the location of `global` it is unspecified where log entries are - // actually stored. - // - // After a bucket has been created, the location cannot be changed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describes this bucket. - string description = 3; - - // Output only. The creation timestamp of the bucket. This is not set for any - // of the default buckets. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the bucket. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Logs will be retained by default for this amount of time, after which they - // will automatically be deleted. The minimum retention period is 1 day. If - // this value is set to zero at bucket creation time, the default time of 30 - // days will be used. - int32 retention_days = 11; - - // Whether the bucket is locked. - // - // The retention period on a locked bucket cannot be changed. Locked buckets - // may only be deleted if they are empty. - bool locked = 9; - - // Output only. The bucket lifecycle state. - LifecycleState lifecycle_state = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether log analytics is enabled for this bucket. - // - // Once enabled, log analytics features cannot be disabled. - bool analytics_enabled = 14; - - // Log entry field paths that are denied access in this bucket. - // - // The following fields and their children are eligible: `textPayload`, - // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. - // - // Restricting a repeated field will restrict all values. Adding a parent will - // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) - repeated string restricted_fields = 15; - - // A list of indexed fields and related configuration data. - repeated IndexConfig index_configs = 17; - - // The CMEK settings of the log bucket. If present, new log entries written to - // this log bucket are encrypted using the CMEK key provided in this - // configuration. If a log bucket has CMEK settings, the CMEK settings cannot - // be disabled later by updating the log bucket. Changing the KMS key is - // allowed. - CmekSettings cmek_settings = 19; -} - -// Describes a view over log entries in a bucket. -message LogView { - option (google.api.resource) = { - type: "logging.googleapis.com/LogView" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" - }; - - // The resource name of the view. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` - string name = 1; - - // Describes this view. - string description = 3; - - // Output only. The creation timestamp of the view. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the view. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Filter that restricts which log entries in a bucket are visible in this - // view. - // - // Filters are restricted to be a logical AND of ==/!= of any of the - // following: - // - // - originating project/folder/organization/billing account. - // - resource type - // - log id - // - // For example: - // - // SOURCE("projects/myproject") AND resource.type = "gce_instance" - // AND LOG_ID("stdout") - string filter = 7; -} - -// Describes a sink used to export log entries to one of the following -// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a -// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log -// entries are exported. The sink must be created within a project, -// organization, billing account, or folder. -message LogSink { - option (google.api.resource) = { - type: "logging.googleapis.com/LogSink" - pattern: "projects/{project}/sinks/{sink}" - pattern: "organizations/{organization}/sinks/{sink}" - pattern: "folders/{folder}/sinks/{sink}" - pattern: "billingAccounts/{billing_account}/sinks/{sink}" - }; - - // Deprecated. This is unused. - enum VersionFormat { - // An unspecified format version that will default to V2. - VERSION_FORMAT_UNSPECIFIED = 0; - - // `LogEntry` version 2 format. - V2 = 1; - - // `LogEntry` version 1 format. - V1 = 2; - } - - // Required. The client-assigned sink identifier, unique within the project. - // - // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited - // to 100 characters and can include only the following characters: upper and - // lower-case alphanumeric characters, underscores, hyphens, and periods. - // First character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The export destination: - // - // "storage.googleapis.com/[GCS_BUCKET]" - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" - // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - // - // The sink's `writer_identity`, set when the sink is created, must have - // permission to write to the destination or else the log entries are not - // exported. For more information, see - // [Exporting Logs with - // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - string destination = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Optional. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The - // only exported log entries are those that are in the resource owning the - // sink and that match the filter. - // - // For example: - // - // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A description of this sink. - // - // The maximum length of the description is 8000 characters. - string description = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, then this sink is disabled and it does not export - // any log entries. - bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Log entries that match any of these exclusion filters will not be - // exported. - // - // If a log entry is matched by both `filter` and one of `exclusion_filters` - // it will not be exported. - repeated LogExclusion exclusions = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Deprecated. This field is unused. - VersionFormat output_version_format = 6 [deprecated = true]; - - // Output only. An IAM identity—a service account or group—under - // which Cloud Logging writes the exported log entries to the sink's - // destination. This field is either set by specifying - // `custom_writer_identity` or set automatically by - // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and - // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the - // value of `unique_writer_identity` in those methods. - // - // Until you grant this identity write-access to the destination, log entry - // exports from this sink will fail. For more information, see [Granting - // Access for a - // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). - // Consult the destination service's documentation to determine the - // appropriate IAM roles to assign to the identity. - // - // Sinks that have a destination that is a log bucket in the same project as - // the sink cannot have a writer_identity and no additional permissions are - // required. - string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This field applies only to sinks owned by organizations and - // folders. If the field is false, the default, only the logs owned by the - // sink's parent resource are available for export. If the field is true, then - // log entries from all the projects, folders, and billing accounts contained - // in the sink's parent resource are also available for export. Whether a - // particular log entry from the children is exported depends on the sink's - // filter expression. - // - // For example, if this field is true, then the filter - // `resource.type=gce_instance` would export all Compute Engine VM instance - // log entries from all projects in the sink's parent. - // - // To only export entries from certain child projects, filter on the project - // part of the log name: - // - // logName:("projects/test-project1/" OR "projects/test-project2/") AND - // resource.type=gce_instance - bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Destination dependent options. - oneof options { - // Optional. Options that affect sinks exporting data to BigQuery. - BigQueryOptions bigquery_options = 12 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The creation timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp create_time = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp update_time = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a BigQuery dataset that was created by a link. -message BigQueryDataset { - // Output only. The full resource name of the BigQuery dataset. The DATASET_ID - // will match the ID of the link, so the link must match the naming - // restrictions of BigQuery datasets (alphanumeric characters and underscores - // only). - // - // The dataset will have a resource path of - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]" - string dataset_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes a link connected to an analytics enabled bucket. -message Link { - option (google.api.resource) = { - type: "logging.googleapis.com/Link" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}" - }; - - // The resource name of the link. The name can have up to 100 characters. - // A valid link id (at the end of the link name) must only have alphanumeric - // characters and underscores within it. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/links/my_link - string name = 1; - - // Describes this link. - // - // The maximum length of the description is 8000 characters. - string description = 2; - - // Output only. The creation timestamp of the link. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The resource lifecycle state. - LifecycleState lifecycle_state = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The information of a BigQuery Dataset. When a link is created, a BigQuery - // dataset is created along with it, in the same project as the LogBucket it's - // linked to. This dataset will also have BigQuery Views corresponding to the - // LogViews in the bucket. - BigQueryDataset bigquery_dataset = 5; -} - -// Options that change functionality of a sink exporting data to BigQuery. -message BigQueryOptions { - // Optional. Whether to use [BigQuery's partition - // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By - // default, Cloud Logging creates dated tables based on the log entries' - // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix - // is no longer present and [special query - // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) - // has to be used instead. In both cases, tables are sharded based on UTC - // timezone. - bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. True if new timestamp column based partitioning is in use, - // false if legacy ingestion-time partitioning is in use. - // - // All new sinks will have this field set true and will use timestamp column - // based partitioning. If use_partitioned_tables is false, this value has no - // meaning and will be false. Legacy sinks using partitioned tables will have - // this field set to false. - bool uses_timestamp_column_partitioning = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The parameters to `ListBuckets`. -message ListBucketsRequest { - // Required. The parent resource whose buckets are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - // - // Note: The locations portion of the resource must be specified, but - // supplying the character `-` in place of [LOCATION_ID] will return all - // buckets. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListBuckets. -message ListBucketsResponse { - // A list of buckets. - repeated LogBucket buckets = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateBucket`. -message CreateBucketRequest { - // Required. The resource in which to create the log bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // - // For example: - // - // `"projects/my-project/locations/global"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - // are limited to 100 characters and can include only letters, digits, - // underscores, hyphens, and periods. - string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new bucket. The region specified in the new bucket must be - // compliant with any Location Restriction Org Policy. The name field in the - // bucket is ignored. - LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateBucket`. -message UpdateBucketRequest { - // Required. The full resource name of the bucket to update. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. The updated bucket. - LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask that specifies the fields in `bucket` that need an - // update. A bucket field will be overwritten if, and only if, it is in the - // update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see: - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=retention_days` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `GetBucket`. -message GetBucketRequest { - // Required. The resource name of the bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `DeleteBucket`. -message DeleteBucketRequest { - // Required. The full resource name of the bucket to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `UndeleteBucket`. -message UndeleteBucketRequest { - // Required. The full resource name of the bucket to undelete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `ListViews`. -message ListViewsRequest { - // Required. The bucket whose views are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListViews. -message ListViewsResponse { - // A list of views. - repeated LogView views = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateView`. -message CreateViewRequest { - // Required. The bucket in which to create the view - // - // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A client-assigned identifier such as `"my-view"`. Identifiers are - // limited to 100 characters and can include only letters, digits, - // underscores, hyphens, and periods. - string view_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new view. - LogView view = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateView`. -message UpdateViewRequest { - // Required. The full resource name of the view to update - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The updated view. - LogView view = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that specifies the fields in `view` that need - // an update. A field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `GetView`. -message GetViewRequest { - // Required. The resource name of the policy: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } - ]; -} - -// The parameters to `DeleteView`. -message DeleteViewRequest { - // Required. The full resource name of the view to delete: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogView" } - ]; -} - -// The parameters to `ListSinks`. -message ListSinksRequest { - // Required. The parent resource whose sinks are to be listed: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListSinks`. -message ListSinksResponse { - // A list of sinks. - repeated LogSink sinks = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `GetSink`. -message GetSinkRequest { - // Required. The resource name of the sink: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; -} - -// The parameters to `CreateSink`. -message CreateSinkRequest { - // Required. The resource in which to create the sink: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - // - // For examples: - // - // `"projects/my-project"` - // `"organizations/123456789"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The new sink, whose `name` parameter is a sink identifier that - // is not already in use. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines the kind of IAM identity returned as `writer_identity` - // in the new sink. If this value is omitted or set to false, and if the - // sink's parent is a project, then the value returned as `writer_identity` is - // the same group or service account used by Cloud Logging before the addition - // of writer identities to this API. The sink's destination must be in the - // same project as the sink itself. - // - // If this field is set to true, or if the sink is owned by a non-project - // resource such as an organization, then the value of `writer_identity` will - // be a unique service account used only for exports from the new sink. For - // more information, see `writer_identity` in - // [LogSink][google.logging.v2.LogSink]. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `UpdateSink`. -message UpdateSinkRequest { - // Required. The full resource name of the sink to update, including the - // parent resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; - - // Required. The updated sink, whose name is the same identifier that appears - // as part of `sink_name`. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] - // for a description of this field. When updating a sink, the effect of this - // field on the value of `writer_identity` in the updated sink depends on both - // the old and new values of this field: - // - // + If the old and new values of this field are both false or both true, - // then there is no change to the sink's `writer_identity`. - // + If the old value is false and the new value is true, then - // `writer_identity` is changed to a unique service account. - // + It is an error if the old value is true and the new value is - // set to false or defaulted to false. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field mask that specifies the fields in `sink` that need - // an update. A sink field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // An empty `updateMask` is temporarily treated as using the following mask - // for backwards compatibility purposes: - // - // `destination,filter,includeChildren` - // - // At some point in the future, behavior will be removed and specifying an - // empty `updateMask` will be an error. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `DeleteSink`. -message DeleteSinkRequest { - // Required. The full resource name of the sink to delete, including the - // parent resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/LogSink" } - ]; -} - -// The parameters to CreateLink. -message CreateLinkRequest { - // Required. The full resource name of the bucket to create a link for. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Link" - } - ]; - - // Required. The new link. - Link link = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the link. The link_id can have up to 100 - // characters. A valid link_id must only have alphanumeric characters and - // underscores within it. - string link_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLink. -message DeleteLinkRequest { - // Required. The full resource name of the link to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } - ]; -} - -// The parameters to ListLinks. -message ListLinksRequest { - // Required. The parent resource whose links are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Link" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListLinks. -message ListLinksResponse { - // A list of links. - repeated Link links = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLink. -message GetLinkRequest { - // Required. The resource name of the link: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "logging.googleapis.com/Link" } - ]; -} - -// Specifies a set of log entries that are filtered out by a sink. If -// your Google Cloud resource receives a large volume of log entries, you can -// use exclusions to reduce your chargeable logs. Note that exclusions on -// organization-level and folder-level sinks don't apply to child resources. -// Note also that you cannot modify the _Required sink or exclude logs from it. -message LogExclusion { - option (google.api.resource) = { - type: "logging.googleapis.com/LogExclusion" - pattern: "projects/{project}/exclusions/{exclusion}" - pattern: "organizations/{organization}/exclusions/{exclusion}" - pattern: "folders/{folder}/exclusions/{exclusion}" - pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" - }; - - // Required. A client-assigned identifier, such as - // `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and - // can include only letters, digits, underscores, hyphens, and periods. First - // character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A description of this exclusion. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that - // matches the log entries to be excluded. By using the [sample - // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), - // you can exclude less than 100% of the matching log entries. - // - // For example, the following query matches 99% of low-severity log entries - // from Google Cloud Storage buckets: - // - // `resource.type=gcs_bucket severity=ERROR" - // - // The maximum length of the filter is 20000 characters. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The resource name of the Log Bucket that owns the Log Metric. - // Only Log Buckets in projects are supported. The bucket has to be in the - // same project as the metric. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // If empty, then the Log Metric is considered a non-Bucket Log Metric. - string bucket_name = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to True, then this metric is disabled and it does not - // generate any points. - bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The metric descriptor associated with the logs-based metric. - // If unspecified, it uses a default metric descriptor with a DELTA metric - // kind, INT64 value type, with no labels and a unit of "1". Such a metric - // counts the number of log entries matching the `filter` expression. - // - // The `name`, `type`, and `description` fields in the `metric_descriptor` - // are output only, and is constructed using the `name` and `description` - // field in the LogMetric. - // - // To create a logs-based metric that records a distribution of log values, a - // DELTA metric kind with a DISTRIBUTION value type must be used along with - // a `value_extractor` expression in the LogMetric. - // - // Each label in the metric descriptor must have a matching label - // name as the key and an extractor expression as the value in the - // `label_extractors` map. - // - // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot - // be updated once initially configured. New labels can be added in the - // `metric_descriptor`, but existing labels cannot be modified except for - // their description. - google.api.MetricDescriptor metric_descriptor = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A `value_extractor` is required when using a distribution - // logs-based metric to extract the values to record from a log entry. - // Two functions are supported for value extraction: `EXTRACT(field)` or - // `REGEXP_EXTRACT(field, regex)`. The arguments are: - // - // 1. field: The name of the log entry field from which the value is to be - // extracted. - // 2. regex: A regular expression using the Google RE2 syntax - // (https://github.com/google/re2/wiki/Syntax) with a single capture - // group to extract data from the specified log entry field. The value - // of the field is converted to a string before applying the regex. - // It is an error to specify a regex that does not include exactly one - // capture group. - // - // The result of the extraction must be convertible to a double type, as the - // distribution always records double values. If either the extraction or - // the conversion to double fails, then those values are not recorded in the - // distribution. - // - // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` - string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map from a label key string to an extractor expression which is - // used to extract data from a log entry field and assign as the label value. - // Each label key specified in the LabelDescriptor must have an associated - // extractor expression in this map. The syntax of the extractor expression - // is the same as for the `value_extractor` field. - // - // The extracted value is converted to the type defined in the label - // descriptor. If either the extraction or the type conversion fails, - // the label will have a default value. The default value for a string - // label is an empty string, for an integer label its 0, and for a boolean - // label its `false`. - // - // Note that there are upper bounds on the maximum number of labels and the - // number of active time series that are allowed in a project. - map label_extractors = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `bucket_options` are required when the logs-based metric is - // using a DISTRIBUTION value type and it describes the bucket boundaries - // used to create a histogram of the extracted values. - google.api.Distribution.BucketOptions bucket_options = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The creation timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp create_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp update_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Deprecated. The API version that created or updated this metric. - // The v2 format is used by default and cannot be changed. - ApiVersion version = 4 [deprecated = true]; -} - -// The parameters to ListLogMetrics. -message ListLogMetricsRequest { - // Required. The name of the project containing the metrics: - // - // "projects/[PROJECT_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogMetrics. -message ListLogMetricsResponse { - // A list of logs-based metrics. - repeated LogMetric metrics = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLogMetric. -message GetLogMetricRequest { - // Required. The resource name of the desired metric: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} - -// The parameters to CreateLogMetric. -message CreateLogMetricRequest { - // Required. The resource name of the project in which to create the metric: - // - // "projects/[PROJECT_ID]" - // - // The new metric must be provided in the request. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The new logs-based metric, which must not have an identifier that - // already exists. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to UpdateLogMetric. -message UpdateLogMetricRequest { - // Required. The resource name of the metric to update: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - // - // The updated metric must be provided in the request and it's - // `name` field must be the same as `[METRIC_ID]` If the metric - // does not exist in `[PROJECT_ID]`, then a new metric is created. - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The updated metric. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLogMetric. -message DeleteLogMetricRequest { - // Required. The resource name of the metric to delete: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} diff --git a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js deleted file mode 100644 index 23bfc32a..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.copy_log_entries.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, destination) { - // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Log bucket from which to copy log entries. - * For example: - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - */ - // const name = 'abc123' - /** - * Optional. A filter specifying which log entries to copy. The filter must be - * no more than 20k characters. An empty filter matches all log entries. - */ - // const filter = 'abc123' - /** - * Required. Destination to which to copy log entries. - */ - // const destination = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCopyLogEntries() { - // Construct request - const request = { - name, - destination, - }; - - // Run request - const [operation] = await loggingClient.copyLogEntries(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCopyLogEntries(); - // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_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/config_service_v2.create_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js deleted file mode 100644 index 1de575fc..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucket() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const response = await loggingClient.createBucket(request); - console.log(response); - } - - callCreateBucket(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucket_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/config_service_v2.create_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js deleted file mode 100644 index 864ee229..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_bucket_async.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucketAsync() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const [operation] = await loggingClient.createBucketAsync(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBucketAsync(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucketAsync_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/config_service_v2.create_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js deleted file mode 100644 index e2fa1898..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_exclusion.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, exclusion) { - // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource in which to create the exclusion: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-logging-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - */ - // const exclusion = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateExclusion() { - // Construct request - const request = { - parent, - exclusion, - }; - - // Run request - const response = await loggingClient.createExclusion(request); - console.log(response); - } - - callCreateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_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/config_service_v2.create_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js deleted file mode 100644 index 56e3e2ad..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_link.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, link, linkId) { - // [START logging_v2_generated_ConfigServiceV2_CreateLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to create a link for. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Required. The new link. - */ - // const link = {} - /** - * Required. The ID to use for the link. The link_id can have up to 100 - * characters. A valid link_id must only have alphanumeric characters and - * underscores within it. - */ - // const linkId = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateLink() { - // Construct request - const request = { - parent, - link, - linkId, - }; - - // Run request - const [operation] = await loggingClient.createLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateLink(); - // [END logging_v2_generated_ConfigServiceV2_CreateLink_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/config_service_v2.create_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js deleted file mode 100644 index 46f64094..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_sink.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, sink) { - // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the sink: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - */ - // const sink = {} - /** - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in - * LogSink google.logging.v2.LogSink. - */ - // const uniqueWriterIdentity = true - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateSink() { - // Construct request - const request = { - parent, - sink, - }; - - // Run request - const response = await loggingClient.createSink(request); - console.log(response); - } - - callCreateSink(); - // [END logging_v2_generated_ConfigServiceV2_CreateSink_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/config_service_v2.create_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js deleted file mode 100644 index 1d598493..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.create_view.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, viewId, view) { - // [START logging_v2_generated_ConfigServiceV2_CreateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket in which to create the view - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-view"`. Identifiers are - * limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - */ - // const viewId = 'abc123' - /** - * Required. The new view. - */ - // const view = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateView() { - // Construct request - const request = { - parent, - viewId, - view, - }; - - // Run request - const response = await loggingClient.createView(request); - console.log(response); - } - - callCreateView(); - // [END logging_v2_generated_ConfigServiceV2_CreateView_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/config_service_v2.delete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js deleted file mode 100644 index 368c926b..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteBucket(request); - console.log(response); - } - - callDeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_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/config_service_v2.delete_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js deleted file mode 100644 index bf359314..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_exclusion.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion to delete: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteExclusion(request); - console.log(response); - } - - callDeleteExclusion(); - // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_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/config_service_v2.delete_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js deleted file mode 100644 index 6a714386..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_link.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the link to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteLink() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await loggingClient.deleteLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteLink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteLink_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/config_service_v2.delete_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js deleted file mode 100644 index 0d90840d..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_sink.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to delete, including the - * parent resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.deleteSink(request); - console.log(response); - } - - callDeleteSink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteSink_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/config_service_v2.delete_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js deleted file mode 100644 index 92ef8caf..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.delete_view.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to delete: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteView(request); - console.log(response); - } - - callDeleteView(); - // [END logging_v2_generated_ConfigServiceV2_DeleteView_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/config_service_v2.get_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js deleted file mode 100644 index 0f9a7811..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getBucket(request); - console.log(response); - } - - callGetBucket(); - // [END logging_v2_generated_ConfigServiceV2_GetBucket_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/config_service_v2.get_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js deleted file mode 100644 index 1256b615..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_cmek_settings.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve CMEK settings. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetCmekSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getCmekSettings(request); - console.log(response); - } - - callGetCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_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/config_service_v2.get_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js deleted file mode 100644 index a9459c99..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_exclusion.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getExclusion(request); - console.log(response); - } - - callGetExclusion(); - // [END logging_v2_generated_ConfigServiceV2_GetExclusion_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/config_service_v2.get_link.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js deleted file mode 100644 index d95999ae..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_link.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the link: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetLink() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getLink(request); - console.log(response); - } - - callGetLink(); - // [END logging_v2_generated_ConfigServiceV2_GetLink_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/config_service_v2.get_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js deleted file mode 100644 index 99df9924..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_settings.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve settings. - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetSettings_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/config_service_v2.get_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js deleted file mode 100644 index 21e331ee..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_sink.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_GetSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the sink: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.getSink(request); - console.log(response); - } - - callGetSink(); - // [END logging_v2_generated_ConfigServiceV2_GetSink_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/config_service_v2.get_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js deleted file mode 100644 index d487ce10..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.get_view.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the policy: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getView(request); - console.log(response); - } - - callGetView(); - // [END logging_v2_generated_ConfigServiceV2_GetView_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/config_service_v2.list_buckets.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js deleted file mode 100644 index 48c9e415..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_buckets.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose buckets are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of LOCATION_ID will return all - * buckets. - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListBuckets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listBucketsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuckets(); - // [END logging_v2_generated_ConfigServiceV2_ListBuckets_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/config_service_v2.list_exclusions.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js deleted file mode 100644 index 888d53fd..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_exclusions.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose exclusions are to be listed. - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListExclusions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listExclusionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExclusions(); - // [END logging_v2_generated_ConfigServiceV2_ListExclusions_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/config_service_v2.list_links.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js deleted file mode 100644 index fa5ac843..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_links.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListLinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose links are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListLinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLinks(); - // [END logging_v2_generated_ConfigServiceV2_ListLinks_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/config_service_v2.list_sinks.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js deleted file mode 100644 index 85486c8c..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_sinks.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose sinks are to be listed: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListSinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listSinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSinks(); - // [END logging_v2_generated_ConfigServiceV2_ListSinks_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/config_service_v2.list_views.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js deleted file mode 100644 index 815ee322..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.list_views.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListViews_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket whose views are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListViews() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listViewsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListViews(); - // [END logging_v2_generated_ConfigServiceV2_ListViews_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/config_service_v2.undelete_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js deleted file mode 100644 index da866082..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.undelete_bucket.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to undelete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUndeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.undeleteBucket(request); - console.log(response); - } - - callUndeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_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/config_service_v2.update_bucket.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js deleted file mode 100644 index 9c98e2d3..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucket() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const response = await loggingClient.updateBucket(request); - console.log(response); - } - - callUpdateBucket(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_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/config_service_v2.update_bucket_async.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js deleted file mode 100644 index a06c31cc..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_bucket_async.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucketAsync() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const [operation] = await loggingClient.updateBucketAsync(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBucketAsync(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_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/config_service_v2.update_cmek_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js deleted file mode 100644 index 09012657..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_cmek_settings.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, cmekSettings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the CMEK settings to update. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The CMEK settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const cmekSettings = {} - /** - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateCmekSettings() { - // Construct request - const request = { - name, - cmekSettings, - }; - - // Run request - const response = await loggingClient.updateCmekSettings(request); - console.log(response); - } - - callUpdateCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_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/config_service_v2.update_exclusion.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js deleted file mode 100644 index 11cc66d5..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_exclusion.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, exclusion, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the exclusion to update: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - /** - * Required. New values for the existing exclusion. Only the fields specified - * in `update_mask` are relevant. - */ - // const exclusion = {} - /** - * Required. A non-empty list of fields to change in the existing exclusion. - * New values for the fields are taken from the corresponding fields in the - * LogExclusion google.logging.v2.LogExclusion included in this request. - * Fields not mentioned in `update_mask` are not changed and are ignored in - * the request. - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateExclusion() { - // Construct request - const request = { - name, - exclusion, - updateMask, - }; - - // Run request - const response = await loggingClient.updateExclusion(request); - console.log(response); - } - - callUpdateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_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/config_service_v2.update_settings.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js deleted file mode 100644 index 35ebd66f..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_settings.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, settings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the settings to update. - * "organizations/[ORGANIZATION_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const settings = {} - /** - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSettings() { - // Construct request - const request = { - name, - settings, - }; - - // Run request - const response = await loggingClient.updateSettings(request); - console.log(response); - } - - callUpdateSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_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/config_service_v2.update_sink.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js deleted file mode 100644 index 7fd08496..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_sink.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(sinkName, sink) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to update, including the - * parent resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - /** - * Required. The updated sink, whose name is the same identifier that appears - * as part of `sink_name`. - */ - // const sink = {} - /** - * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - */ - // const uniqueWriterIdentity = true - /** - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * `destination,filter,includeChildren` - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSink() { - // Construct request - const request = { - sinkName, - sink, - }; - - // Run request - const response = await loggingClient.updateSink(request); - console.log(response); - } - - callUpdateSink(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSink_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/config_service_v2.update_view.js b/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js deleted file mode 100644 index acc6bfb9..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/config_service_v2.update_view.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, view) { - // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to update - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - /** - * Required. The updated view. - */ - // const view = {} - /** - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateView() { - // Construct request - const request = { - name, - view, - }; - - // Run request - const response = await loggingClient.updateView(request); - console.log(response); - } - - callUpdateView(); - // [END logging_v2_generated_ConfigServiceV2_UpdateView_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/logging_service_v2.delete_log.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js deleted file mode 100644 index c8b817e7..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.delete_log.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(logName) { - // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the log to delete: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * For more information about log names, see - * LogEntry google.logging.v2.LogEntry. - */ - // const logName = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callDeleteLog() { - // Construct request - const request = { - logName, - }; - - // Run request - const response = await loggingClient.deleteLog(request); - console.log(response); - } - - callDeleteLog(); - // [END logging_v2_generated_LoggingServiceV2_DeleteLog_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/logging_service_v2.list_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js deleted file mode 100644 index 355fcc84..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_log_entries.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - */ - // const filter = 'abc123' - /** - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - */ - // const orderBy = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const iterable = await loggingClient.listLogEntriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_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/logging_service_v2.list_logs.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js deleted file mode 100644 index 1e8c7caa..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_logs.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name to list logs for: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const parent = 'abc123' - /** - * Optional. List of resource names to list logs for: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * To support legacy queries, it could also be: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * The resource name in the `parent` field is added to this list. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogs(); - // [END logging_v2_generated_LoggingServiceV2_ListLogs_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/logging_service_v2.list_monitored_resource_descriptors.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js deleted file mode 100644 index 4552dacd..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - }; - - // Run request - const iterable = await loggingClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_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/logging_service_v2.tail_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js deleted file mode 100644 index a0d3eeb7..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.tail_log_entries.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of a parent resource from which to retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - */ - // const resourceNames = ['abc','def'] - /** - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - */ - // const filter = 'abc123' - /** - * Optional. The amount of time to buffer log entries at the server before - * being returned to prevent out of order results due to late arriving log - * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - * milliseconds. - */ - // const bufferWindow = {} - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callTailLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const stream = await loggingClient.tailLogEntries(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callTailLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_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/logging_service_v2.write_log_entries.js b/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js deleted file mode 100644 index 888245ae..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/logging_service_v2.write_log_entries.js +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(entries) { - // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example: - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - */ - // const logName = 'abc123' - /** - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * See LogEntry google.logging.v2.LogEntry. - */ - // const resource = {} - /** - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See LogEntry google.logging.v2.LogEntry. - */ - // const labels = [1,2,3,4] - /** - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * LogEntry google.logging.v2.LogEntry type. - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * Log entries with timestamps that are more than the - * logs retention period (https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be exported - * with - * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * To improve throughput and to avoid exceeding the - * quota limit (https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - */ - // const entries = [1,2,3,4] - /** - * Optional. Whether a batch's valid entries should be written even if some - * other entry failed due to a permanent error such as INVALID_ARGUMENT or - * PERMISSION_DENIED. If any entry failed, then the response status is the - * response status of one of the failed entries. The response will include - * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - * the entries' zero-based index in the `entries`. Failed requests for which - * no entries are written will not include per-entry errors. - */ - // const partialSuccess = true - /** - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - */ - // const dryRun = true - - // Imports the Logging library - const {LoggingServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callWriteLogEntries() { - // Construct request - const request = { - entries, - }; - - // Run request - const response = await loggingClient.writeLogEntries(request); - console.log(response); - } - - callWriteLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_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/metrics_service_v2.create_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js deleted file mode 100644 index b48ae935..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.create_log_metric.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, metric) { - // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project in which to create the metric: - * "projects/[PROJECT_ID]" - * The new metric must be provided in the request. - */ - // const parent = 'abc123' - /** - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callCreateLogMetric() { - // Construct request - const request = { - parent, - metric, - }; - - // Run request - const response = await loggingClient.createLogMetric(request); - console.log(response); - } - - callCreateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_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/metrics_service_v2.delete_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js deleted file mode 100644 index 661e224f..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.delete_log_metric.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to delete: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callDeleteLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.deleteLogMetric(request); - console.log(response); - } - - callDeleteLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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/metrics_service_v2.get_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js deleted file mode 100644 index c8d8b6a0..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.get_log_metric.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the desired metric: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callGetLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.getLogMetric(request); - console.log(response); - } - - callGetLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_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/metrics_service_v2.list_log_metrics.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js deleted file mode 100644 index 558322ef..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.list_log_metrics.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project containing the metrics: - * "projects/[PROJECT_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callListLogMetrics() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await loggingClient.listLogMetricsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogMetrics(); - // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_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/metrics_service_v2.update_log_metric.js b/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js deleted file mode 100644 index 942d8246..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/metrics_service_v2.update_log_metric.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(metricName, metric) { - // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to update: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - */ - // const metricName = 'abc123' - /** - * Required. The updated metric. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('@google-cloud/logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callUpdateLogMetric() { - // Construct request - const request = { - metricName, - metric, - }; - - // Run request - const response = await loggingClient.updateLogMetric(request); - console.log(response); - } - - callUpdateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_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.logging.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json deleted file mode 100644 index c6798780..00000000 --- a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata_google.logging.v2.json +++ /dev/null @@ -1,1963 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-logging", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.logging.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", - "title": "logging listBuckets Sample", - "origin": "API_DEFINITION", - "description": " Lists log buckets.", - "canonical": true, - "file": "config_service_v2.list_buckets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListBucketsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", - "title": "logging getBucket Sample", - "origin": "API_DEFINITION", - "description": " Gets a log bucket.", - "canonical": true, - "file": "config_service_v2.get_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async", - "title": "logging createBucketAsync Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket asynchronously that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucketAsync", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async", - "title": "logging updateBucketAsync Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket asynchronously. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucketAsync", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucketAsync", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", - "title": "logging createBucket Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", - "title": "logging updateBucket Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", - "title": "logging deleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", - "canonical": true, - "file": "config_service_v2.delete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", - "title": "logging undeleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", - "canonical": true, - "file": "config_service_v2.undelete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", - "title": "logging listViews Sample", - "origin": "API_DEFINITION", - "description": " Lists views on a log bucket.", - "canonical": true, - "file": "config_service_v2.list_views.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListViewsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", - "title": "logging getView Sample", - "origin": "API_DEFINITION", - "description": " Gets a view on a log bucket..", - "canonical": true, - "file": "config_service_v2.get_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", - "title": "logging createView Sample", - "origin": "API_DEFINITION", - "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", - "canonical": true, - "file": "config_service_v2.create_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", - "title": "logging updateView Sample", - "origin": "API_DEFINITION", - "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.update_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", - "title": "logging deleteView Sample", - "origin": "API_DEFINITION", - "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.delete_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", - "title": "logging listSinks Sample", - "origin": "API_DEFINITION", - "description": " Lists sinks.", - "canonical": true, - "file": "config_service_v2.list_sinks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListSinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", - "title": "logging getSink Sample", - "origin": "API_DEFINITION", - "description": " Gets a sink.", - "canonical": true, - "file": "config_service_v2.get_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", - "title": "logging createSink Sample", - "origin": "API_DEFINITION", - "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", - "canonical": true, - "file": "config_service_v2.create_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", - "title": "logging updateSink Sample", - "origin": "API_DEFINITION", - "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", - "canonical": true, - "file": "config_service_v2.update_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", - "title": "logging deleteSink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", - "canonical": true, - "file": "config_service_v2.delete_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateLink_async", - "title": "logging createLink Sample", - "origin": "API_DEFINITION", - "description": " Asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.", - "canonical": true, - "file": "config_service_v2.create_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "link", - "type": ".google.logging.v2.Link" - }, - { - "name": "link_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateLink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteLink_async", - "title": "logging deleteLink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a link. This will also delete the corresponding BigQuery linked dataset.", - "canonical": true, - "file": "config_service_v2.delete_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteLink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListLinks_async", - "title": "logging listLinks Sample", - "origin": "API_DEFINITION", - "description": " Lists links.", - "canonical": true, - "file": "config_service_v2.list_links.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListLinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListLinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetLink_async", - "title": "logging getLink Sample", - "origin": "API_DEFINITION", - "description": " Gets a link.", - "canonical": true, - "file": "config_service_v2.get_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLink", - "fullName": "google.logging.v2.ConfigServiceV2.GetLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Link", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetLink", - "fullName": "google.logging.v2.ConfigServiceV2.GetLink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", - "title": "logging listExclusions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the exclusions on the _Default sink in a parent resource.", - "canonical": true, - "file": "config_service_v2.list_exclusions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListExclusionsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", - "title": "logging getExclusion Sample", - "origin": "API_DEFINITION", - "description": " Gets the description of an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.get_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", - "title": "logging createExclusion Sample", - "origin": "API_DEFINITION", - "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", - "canonical": true, - "file": "config_service_v2.create_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", - "title": "logging updateExclusion Sample", - "origin": "API_DEFINITION", - "description": " Changes one or more properties of an existing exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.update_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", - "title": "logging deleteExclusion Sample", - "origin": "API_DEFINITION", - "description": " Deletes an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.delete_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", - "title": "logging getCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", - "title": "logging updateCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "cmek_settings", - "type": ".google.logging.v2.CmekSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", - "title": "logging getSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", - "title": "logging updateSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "settings", - "type": ".google.logging.v2.Settings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", - "title": "logging copyLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", - "canonical": true, - "file": "config_service_v2.copy_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "destination", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", - "title": "logging deleteLog Sample", - "origin": "API_DEFINITION", - "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", - "canonical": true, - "file": "logging_service_v2.delete_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", - "title": "logging writeLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", - "canonical": true, - "file": "logging_service_v2.write_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 121, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.api.MonitoredResource" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "entries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "partial_success", - "type": "TYPE_BOOL" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.WriteLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", - "title": "logging listLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", - "canonical": true, - "file": "logging_service_v2.list_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 98, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", - "title": "logging listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for monitored resource types used by Logging.", - "canonical": true, - "file": "logging_service_v2.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", - "title": "logging listLogs Sample", - "origin": "API_DEFINITION", - "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", - "canonical": true, - "file": "logging_service_v2.list_logs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", - "title": "logging tailLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", - "canonical": true, - "file": "logging_service_v2.tail_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "buffer_window", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.logging.v2.TailLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", - "title": "logging listLogMetrics Sample", - "origin": "API_DEFINITION", - "description": " Lists logs-based metrics.", - "canonical": true, - "file": "metrics_service_v2.list_log_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLogMetricsResponse", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", - "title": "logging getLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Gets a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.get_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", - "title": "logging createLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.create_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", - "title": "logging updateLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.update_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", - "title": "logging deleteLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Deletes a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.delete_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index ca1a43eb..00000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const ConfigServiceV2Client = v2.ConfigServiceV2Client; -type ConfigServiceV2Client = v2.ConfigServiceV2Client; -const LoggingServiceV2Client = v2.LoggingServiceV2Client; -type LoggingServiceV2Client = v2.LoggingServiceV2Client; -const MetricsServiceV2Client = v2.MetricsServiceV2Client; -type MetricsServiceV2Client = v2.MetricsServiceV2Client; -export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts b/owl-bot-staging/v2/src/v2/config_service_v2_client.ts deleted file mode 100644 index f749a38b..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_client.ts +++ /dev/null @@ -1,5530 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/config_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './config_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring sinks used to route log entries. - * @class - * @memberof v2 - */ -export class ConfigServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - configServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConfigServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConfigServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConfigServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listBuckets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), - listViews: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), - listSinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), - listLinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'links'), - listExclusions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=*/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=folders/*/locations/*/operations/*}:cancel',body: '*',},{post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=*/*/locations/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=organizations/*/locations/*/operations/*}',},{get: '/v2/{name=folders/*/locations/*/operations/*}',},{get: '/v2/{name=billingAccounts/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=*/*/locations/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=organizations/*/locations/*}/operations',},{get: '/v2/{name=folders/*/locations/*}/operations',},{get: '/v2/{name=billingAccounts/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createBucketAsyncResponse = protoFilesRoot.lookup( - '.google.logging.v2.LogBucket') as gax.protobuf.Type; - const createBucketAsyncMetadata = protoFilesRoot.lookup( - '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; - const updateBucketAsyncResponse = protoFilesRoot.lookup( - '.google.logging.v2.LogBucket') as gax.protobuf.Type; - const updateBucketAsyncMetadata = protoFilesRoot.lookup( - '.google.logging.v2.BucketMetadata') as gax.protobuf.Type; - const createLinkResponse = protoFilesRoot.lookup( - '.google.logging.v2.Link') as gax.protobuf.Type; - const createLinkMetadata = protoFilesRoot.lookup( - '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; - const deleteLinkResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteLinkMetadata = protoFilesRoot.lookup( - '.google.logging.v2.LinkMetadata') as gax.protobuf.Type; - const copyLogEntriesResponse = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; - const copyLogEntriesMetadata = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBucketAsync: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBucketAsyncResponse.decode.bind(createBucketAsyncResponse), - createBucketAsyncMetadata.decode.bind(createBucketAsyncMetadata)), - updateBucketAsync: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBucketAsyncResponse.decode.bind(updateBucketAsyncResponse), - updateBucketAsyncMetadata.decode.bind(updateBucketAsyncMetadata)), - createLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createLinkResponse.decode.bind(createLinkResponse), - createLinkMetadata.decode.bind(createLinkMetadata)), - deleteLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteLinkResponse.decode.bind(deleteLinkResponse), - deleteLinkMetadata.decode.bind(deleteLinkMetadata)), - copyLogEntries: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), - copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.configServiceV2Stub) { - return this.configServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.ConfigServiceV2. - this.configServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.ConfigServiceV2, - 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 configServiceV2StubMethods = - ['listBuckets', 'getBucket', 'createBucketAsync', 'updateBucketAsync', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'createLink', 'deleteLink', 'listLinks', 'getLink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; - for (const methodName of configServiceV2StubMethods) { - const callPromise = this.configServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.configServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read' - ]; - } - - 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 -- - // ------------------- -/** - * Gets a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async - */ - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBucket(request, options, callback); - } -/** - * Creates a log bucket that can be used to store log entries. After a bucket - * has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async - */ - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBucket(request, options, callback); - } -/** - * Updates a log bucket. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async - */ - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBucket(request, options, callback); - } -/** - * Deletes a log bucket. - * - * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - * After 7 days, the bucket will be purged and all log entries in the bucket - * will be permanently deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async - */ - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBucket(request, options, callback); - } -/** - * Undeletes a log bucket. A bucket that has been deleted can be undeleted - * within the grace period of 7 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to undelete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async - */ - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.undeleteBucket(request, options, callback); - } -/** - * Gets a view on a log bucket.. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async - */ - getView( - request?: protos.google.logging.v2.IGetViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>; - getView( - request: protos.google.logging.v2.IGetViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request: protos.google.logging.v2.IGetViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request?: protos.google.logging.v2.IGetViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getView(request, options, callback); - } -/** - * Creates a view over log entries in a log bucket. A bucket may contain a - * maximum of 30 views. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket in which to create the view - * - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {string} request.viewId - * Required. A client-assigned identifier such as `"my-view"`. Identifiers are - * limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogView} request.view - * Required. The new view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async - */ - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createView(request, options, callback); - } -/** - * Updates a view on a log bucket. This method replaces the following fields - * in the existing view with values from the new view: `filter`. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can update the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to update - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {google.logging.v2.LogView} request.view - * Required. The updated view. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async - */ - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateView(request, options, callback); - } -/** - * Deletes a view on a log bucket. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can delete the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to delete: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async - */ - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteView(request, options, callback); - } -/** - * Gets a sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The resource name of the sink: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async - */ - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSink(request, options, callback); - } -/** - * Creates a sink that exports specified log entries to a destination. The - * export of newly-ingested log entries begins immediately, unless the sink's - * `writer_identity` is not permitted to write to the destination. A sink can - * export log entries only from the resource owning the sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the sink: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in - * {@link protos.google.logging.v2.LogSink|LogSink}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async - */ - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSink(request, options, callback); - } -/** - * Updates a sink. This method replaces the following fields in the existing - * sink with values from the new sink: `destination`, and `filter`. - * - * The updated sink might also have a new `writer_identity`; see the - * `unique_writer_identity` field. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to update, including the - * parent resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The updated sink, whose name is the same identifier that appears - * as part of `sink_name`. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * - * `destination,filter,includeChildren` - * - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async - */ - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSink(request, options, callback); - } -/** - * Deletes a sink. If the sink has a unique `writer_identity`, then that - * service account is also deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to delete, including the - * parent resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async - */ - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSink(request, options, callback); - } -/** - * Gets a link. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the link: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Link|Link}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetLink_async - */ - getLink( - request?: protos.google.logging.v2.IGetLinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined - ]>; - getLink( - request: protos.google.logging.v2.IGetLinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): void; - getLink( - request: protos.google.logging.v2.IGetLinkRequest, - callback: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): void; - getLink( - request?: protos.google.logging.v2.IGetLinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILink, - protos.google.logging.v2.IGetLinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLink(request, options, callback); - } -/** - * Gets the description of an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async - */ - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExclusion(request, options, callback); - } -/** - * Creates a new exclusion in the _Default sink in a specified parent - * resource. Only log entries belonging to that resource can be excluded. You - * can have up to 10 exclusions in a resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource in which to create the exclusion: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-logging-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async - */ - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExclusion(request, options, callback); - } -/** - * Changes one or more properties of an existing exclusion in the _Default - * sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the exclusion to update: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. New values for the existing exclusion. Only the fields specified - * in `update_mask` are relevant. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A non-empty list of fields to change in the existing exclusion. - * New values for the fields are taken from the corresponding fields in the - * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. - * Fields not mentioned in `update_mask` are not changed and are ignored in - * the request. - * - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async - */ - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateExclusion(request, options, callback); - } -/** - * Deletes an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion to delete: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async - */ - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteExclusion(request, options, callback); - } -/** - * Gets the Logging CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve CMEK settings. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async - */ - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCmekSettings(request, options, callback); - } -/** - * Updates the Log Router CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the CMEK settings to update. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.CmekSettings} request.cmekSettings - * Required. The CMEK settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async - */ - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCmekSettings(request, options, callback); - } -/** - * Gets the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve settings. - * - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async - */ - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSettings(request, options, callback); - } -/** - * Updates the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. 4) `location_id` is not supported by - * Logging. 5) `location_id` violate OrgPolicy. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the settings to update. - * - * "organizations/[ORGANIZATION_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.Settings} request.settings - * Required. The settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async - */ - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSettings(request, options, callback); - } - -/** - * Creates a log bucket asynchronously that can be used to store log entries. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers - * are limited to 100 characters and can include only letters, digits, - * underscores, hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be - * compliant with any Location Restriction Org Policy. The name field in the - * bucket is ignored. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async - */ - createBucketAsync( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBucketAsync( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBucketAsync(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBucketAsync()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async - */ - async checkCreateBucketAsyncProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBucketAsync, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a log bucket asynchronously. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an - * update. A bucket field will be overwritten if, and only if, it is in the - * update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async - */ - updateBucketAsync( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBucketAsync( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBucketAsync(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBucketAsync()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async - */ - async checkUpdateBucketAsyncProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBucketAsync, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Asynchronously creates a linked dataset in BigQuery which makes it possible - * to use BigQuery to read the logs stored in the log bucket. A log bucket may - * currently only contain one link. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The full resource name of the bucket to create a link for. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {google.logging.v2.Link} request.link - * Required. The new link. - * @param {string} request.linkId - * Required. The ID to use for the link. The link_id can have up to 100 - * characters. A valid link_id must only have alphanumeric characters and - * underscores within it. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async - */ - createLink( - request?: protos.google.logging.v2.ICreateLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createLink( - request?: protos.google.logging.v2.ICreateLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createLink(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async - */ - async checkCreateLinkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a link. This will also delete the corresponding BigQuery linked - * dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the link to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async - */ - deleteLink( - request?: protos.google.logging.v2.IDeleteLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteLink( - request?: protos.google.logging.v2.IDeleteLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLink(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_link.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async - */ - async checkDeleteLinkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Copies a set of log entries from a log bucket to a Cloud Storage bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Log bucket from which to copy log entries. - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - * @param {string} [request.filter] - * Optional. A filter specifying which log entries to copy. The filter must be - * no more than 20k characters. An empty filter matches all log entries. - * @param {string} request.destination - * Required. Destination to which to copy log entries. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|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 || {}; - this.initialize(); - return this.innerApiCalls.copyLogEntries(request, options, callback); - } -/** - * Check the status of the long running operation returned by `copyLogEntries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - async checkCopyLogEntriesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists log buckets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>, - callback?: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBuckets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogBucket|LogBucket} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBucketsStream( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuckets.createStream( - this.innerApiCalls.listBuckets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuckets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogBucket|LogBucket}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_buckets.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async - */ - listBucketsAsync( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuckets.asyncIterate( - this.innerApiCalls['listBuckets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists views on a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogView|LogView}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>, - callback?: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listViews(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogView|LogView} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listViewsStream( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listViews.createStream( - this.innerApiCalls.listViews as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listViews`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogView|LogView}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_views.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async - */ - listViewsAsync( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listViews.asyncIterate( - this.innerApiCalls['listViews'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists sinks. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogSink|LogSink}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSinks(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogSink|LogSink} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSinksStream( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSinks.createStream( - this.innerApiCalls.listSinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSinks`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogSink|LogSink}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_sinks.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async - */ - listSinksAsync( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSinks.asyncIterate( - this.innerApiCalls['listSinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists links. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.Link|Link}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLinks( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILink[], - protos.google.logging.v2.IListLinksRequest|null, - protos.google.logging.v2.IListLinksResponse - ]>; - listLinks( - request: protos.google.logging.v2.IListLinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): void; - listLinks( - request: protos.google.logging.v2.IListLinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): void; - listLinks( - request?: protos.google.logging.v2.IListLinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLinksRequest, - protos.google.logging.v2.IListLinksResponse|null|undefined, - protos.google.logging.v2.ILink>): - Promise<[ - protos.google.logging.v2.ILink[], - protos.google.logging.v2.IListLinksRequest|null, - protos.google.logging.v2.IListLinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLinks(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.Link|Link} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLinksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLinksStream( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLinks.createStream( - this.innerApiCalls.listLinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLinks`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose links are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.Link|Link}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_links.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListLinks_async - */ - listLinksAsync( - request?: protos.google.logging.v2.IListLinksRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLinks.asyncIterate( - this.innerApiCalls['listLinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the exclusions on the _Default sink in a parent resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>, - callback?: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExclusions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExclusionsStream( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExclusions.createStream( - this.innerApiCalls.listExclusions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExclusions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogExclusion|LogExclusion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.list_exclusions.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async - */ - listExclusionsAsync( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExclusions.asyncIterate( - this.innerApiCalls['listExclusions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.configServiceV2Stub && !this._terminated) { - return this.configServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json deleted file mode 100644 index 0e890aa4..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_client_config.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.ConfigServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "ListBuckets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucketAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucketAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListViews": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSinks": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateSink": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLinks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListExclusions": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CopyLogEntries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/config_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] 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 047d5888..00000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,512 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.logging.v2", - "libraryPackage": "@google-cloud/logging", - "services": { - "ConfigServiceV2": { - "clients": { - "grpc": { - "libraryClient": "ConfigServiceV2Client", - "rpcs": { - "GetBucket": { - "methods": [ - "getBucket" - ] - }, - "CreateBucket": { - "methods": [ - "createBucket" - ] - }, - "UpdateBucket": { - "methods": [ - "updateBucket" - ] - }, - "DeleteBucket": { - "methods": [ - "deleteBucket" - ] - }, - "UndeleteBucket": { - "methods": [ - "undeleteBucket" - ] - }, - "GetView": { - "methods": [ - "getView" - ] - }, - "CreateView": { - "methods": [ - "createView" - ] - }, - "UpdateView": { - "methods": [ - "updateView" - ] - }, - "DeleteView": { - "methods": [ - "deleteView" - ] - }, - "GetSink": { - "methods": [ - "getSink" - ] - }, - "CreateSink": { - "methods": [ - "createSink" - ] - }, - "UpdateSink": { - "methods": [ - "updateSink" - ] - }, - "DeleteSink": { - "methods": [ - "deleteSink" - ] - }, - "GetLink": { - "methods": [ - "getLink" - ] - }, - "GetExclusion": { - "methods": [ - "getExclusion" - ] - }, - "CreateExclusion": { - "methods": [ - "createExclusion" - ] - }, - "UpdateExclusion": { - "methods": [ - "updateExclusion" - ] - }, - "DeleteExclusion": { - "methods": [ - "deleteExclusion" - ] - }, - "GetCmekSettings": { - "methods": [ - "getCmekSettings" - ] - }, - "UpdateCmekSettings": { - "methods": [ - "updateCmekSettings" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateBucketAsync": { - "methods": [ - "createBucketAsync" - ] - }, - "UpdateBucketAsync": { - "methods": [ - "updateBucketAsync" - ] - }, - "CreateLink": { - "methods": [ - "createLink" - ] - }, - "DeleteLink": { - "methods": [ - "deleteLink" - ] - }, - "CopyLogEntries": { - "methods": [ - "copyLogEntries" - ] - }, - "ListBuckets": { - "methods": [ - "listBuckets", - "listBucketsStream", - "listBucketsAsync" - ] - }, - "ListViews": { - "methods": [ - "listViews", - "listViewsStream", - "listViewsAsync" - ] - }, - "ListSinks": { - "methods": [ - "listSinks", - "listSinksStream", - "listSinksAsync" - ] - }, - "ListLinks": { - "methods": [ - "listLinks", - "listLinksStream", - "listLinksAsync" - ] - }, - "ListExclusions": { - "methods": [ - "listExclusions", - "listExclusionsStream", - "listExclusionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConfigServiceV2Client", - "rpcs": { - "GetBucket": { - "methods": [ - "getBucket" - ] - }, - "CreateBucket": { - "methods": [ - "createBucket" - ] - }, - "UpdateBucket": { - "methods": [ - "updateBucket" - ] - }, - "DeleteBucket": { - "methods": [ - "deleteBucket" - ] - }, - "UndeleteBucket": { - "methods": [ - "undeleteBucket" - ] - }, - "GetView": { - "methods": [ - "getView" - ] - }, - "CreateView": { - "methods": [ - "createView" - ] - }, - "UpdateView": { - "methods": [ - "updateView" - ] - }, - "DeleteView": { - "methods": [ - "deleteView" - ] - }, - "GetSink": { - "methods": [ - "getSink" - ] - }, - "CreateSink": { - "methods": [ - "createSink" - ] - }, - "UpdateSink": { - "methods": [ - "updateSink" - ] - }, - "DeleteSink": { - "methods": [ - "deleteSink" - ] - }, - "GetLink": { - "methods": [ - "getLink" - ] - }, - "GetExclusion": { - "methods": [ - "getExclusion" - ] - }, - "CreateExclusion": { - "methods": [ - "createExclusion" - ] - }, - "UpdateExclusion": { - "methods": [ - "updateExclusion" - ] - }, - "DeleteExclusion": { - "methods": [ - "deleteExclusion" - ] - }, - "GetCmekSettings": { - "methods": [ - "getCmekSettings" - ] - }, - "UpdateCmekSettings": { - "methods": [ - "updateCmekSettings" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateBucketAsync": { - "methods": [ - "createBucketAsync" - ] - }, - "UpdateBucketAsync": { - "methods": [ - "updateBucketAsync" - ] - }, - "CreateLink": { - "methods": [ - "createLink" - ] - }, - "DeleteLink": { - "methods": [ - "deleteLink" - ] - }, - "CopyLogEntries": { - "methods": [ - "copyLogEntries" - ] - }, - "ListBuckets": { - "methods": [ - "listBuckets", - "listBucketsStream", - "listBucketsAsync" - ] - }, - "ListViews": { - "methods": [ - "listViews", - "listViewsStream", - "listViewsAsync" - ] - }, - "ListSinks": { - "methods": [ - "listSinks", - "listSinksStream", - "listSinksAsync" - ] - }, - "ListLinks": { - "methods": [ - "listLinks", - "listLinksStream", - "listLinksAsync" - ] - }, - "ListExclusions": { - "methods": [ - "listExclusions", - "listExclusionsStream", - "listExclusionsAsync" - ] - } - } - } - } - }, - "LoggingServiceV2": { - "clients": { - "grpc": { - "libraryClient": "LoggingServiceV2Client", - "rpcs": { - "DeleteLog": { - "methods": [ - "deleteLog" - ] - }, - "WriteLogEntries": { - "methods": [ - "writeLogEntries" - ] - }, - "TailLogEntries": { - "methods": [ - "tailLogEntries" - ] - }, - "ListLogEntries": { - "methods": [ - "listLogEntries", - "listLogEntriesStream", - "listLogEntriesAsync" - ] - }, - "ListMonitoredResourceDescriptors": { - "methods": [ - "listMonitoredResourceDescriptors", - "listMonitoredResourceDescriptorsStream", - "listMonitoredResourceDescriptorsAsync" - ] - }, - "ListLogs": { - "methods": [ - "listLogs", - "listLogsStream", - "listLogsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "LoggingServiceV2Client", - "rpcs": { - "DeleteLog": { - "methods": [ - "deleteLog" - ] - }, - "WriteLogEntries": { - "methods": [ - "writeLogEntries" - ] - }, - "ListLogEntries": { - "methods": [ - "listLogEntries", - "listLogEntriesStream", - "listLogEntriesAsync" - ] - }, - "ListMonitoredResourceDescriptors": { - "methods": [ - "listMonitoredResourceDescriptors", - "listMonitoredResourceDescriptorsStream", - "listMonitoredResourceDescriptorsAsync" - ] - }, - "ListLogs": { - "methods": [ - "listLogs", - "listLogsStream", - "listLogsAsync" - ] - } - } - } - } - }, - "MetricsServiceV2": { - "clients": { - "grpc": { - "libraryClient": "MetricsServiceV2Client", - "rpcs": { - "GetLogMetric": { - "methods": [ - "getLogMetric" - ] - }, - "CreateLogMetric": { - "methods": [ - "createLogMetric" - ] - }, - "UpdateLogMetric": { - "methods": [ - "updateLogMetric" - ] - }, - "DeleteLogMetric": { - "methods": [ - "deleteLogMetric" - ] - }, - "ListLogMetrics": { - "methods": [ - "listLogMetrics", - "listLogMetricsStream", - "listLogMetricsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MetricsServiceV2Client", - "rpcs": { - "GetLogMetric": { - "methods": [ - "getLogMetric" - ] - }, - "CreateLogMetric": { - "methods": [ - "createLogMetric" - ] - }, - "UpdateLogMetric": { - "methods": [ - "updateLogMetric" - ] - }, - "DeleteLogMetric": { - "methods": [ - "deleteLogMetric" - ] - }, - "ListLogMetrics": { - "methods": [ - "listLogMetrics", - "listLogMetricsStream", - "listLogMetricsAsync" - ] - } - } - } - } - } - } -} 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 75a03763..00000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {ConfigServiceV2Client} from './config_service_v2_client'; -export {LoggingServiceV2Client} from './logging_service_v2_client'; -export {MetricsServiceV2Client} from './metrics_service_v2_client'; diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts b/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts deleted file mode 100644 index cdf06265..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_client.ts +++ /dev/null @@ -1,2754 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/logging_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './logging_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for ingesting and querying logs. - * @class - * @memberof v2 - */ -export class LoggingServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - loggingServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LoggingServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new LoggingServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LoggingServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listLogEntries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listLogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback) - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // Some methods on this API support automatically batching - // requests; denote this. - - this.descriptors.batching = { - writeLogEntries: new this._gaxModule.BundleDescriptor( - 'entries', - ['log_name','resource','labels'], - null, - this._gaxModule.GrpcClient.createByteLengthFunction( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.loggingServiceV2Stub) { - return this.loggingServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.LoggingServiceV2. - this.loggingServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.LoggingServiceV2, - 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 loggingServiceV2StubMethods = - ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; - for (const methodName of loggingServiceV2StubMethods) { - const callPromise = this.loggingServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.batching?.[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.loggingServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - 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 -- - // ------------------- -/** - * Deletes all the log entries in a log for the _Default Log Bucket. The log - * reappears if it receives new entries. Log entries written shortly before - * the delete operation might not be deleted. Entries received after the - * delete operation with a timestamp before the operation will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.logName - * Required. The resource name of the log to delete: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * - * For more information about log names, see - * {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.delete_log.js - * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async - */ - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'log_name': request.logName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLog(request, options, callback); - } -/** - * Writes log entries to Logging. This API method is the - * only way to send log entries to Logging. This method - * is used, directly or indirectly, by the Logging agent - * (fluentd) and all logging libraries configured to use Logging. - * A single request may contain log entries for a maximum of 1000 - * different resources (projects, organizations, billing accounts or - * folders) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.logName] - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example: - * - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - * @param {google.api.MonitoredResource} [request.resource] - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} [request.labels] - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} request.entries - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * {@link protos.google.logging.v2.LogEntry|LogEntry} type. - * - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * - * Log entries with timestamps that are more than the - * [logs retention period](https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be [exported - * with - * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * - * To improve throughput and to avoid exceeding the - * [quota limit](https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - * @param {boolean} [request.partialSuccess] - * Optional. Whether a batch's valid entries should be written even if some - * other entry failed due to a permanent error such as INVALID_ARGUMENT or - * PERMISSION_DENIED. If any entry failed, then the response status is the - * response status of one of the failed entries. The response will include - * error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by - * the entries' zero-based index in the `entries`. Failed requests for which - * no entries are written will not include per-entry errors. - * @param {boolean} [request.dryRun] - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async - */ - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|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 || {}; - this.initialize(); - return this.innerApiCalls.writeLogEntries(request, options, callback); - } - -/** - * Streaming read of log entries as they are ingested. Until the stream is - * terminated, it will continue reading logs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and - * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async - */ - tailLogEntries( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.tailLogEntries(null, options); - } - - /** - * Lists log entries. Use this method to retrieve log entries that originated - * from a project/folder/organization/billing account. For ways to export log - * entries, see [Exporting - * Logs](https://cloud.google.com/logging/docs/export). - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>|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 || {}; - this.initialize(); - return this.innerApiCalls.listLogEntries(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogEntry|LogEntry} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogEntriesStream( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogEntries.createStream( - this.innerApiCalls.listLogEntries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogEntries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * A maximum of 100 resources may be specified in a single request. - * @param {string} [request.filter] - * Optional. Only log entries that match the filter are returned. An empty - * filter matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of a filter is - * 20,000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Default is 50. If the value is negative or exceeds 1000, the request is - * rejected. The presence of `next_page_token` in the response indicates that - * more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogEntry|LogEntry}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async - */ - listLogEntriesAsync( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogEntries.asyncIterate( - this.innerApiCalls['listLogEntries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the descriptors for monitored resource types used by Logging. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>|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 || {}; - this.initialize(); - return this.innerApiCalls.listMonitoredResourceDescriptors(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the logs in projects, organizations, folders, or billing accounts. - * Only logs that have entries are listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLogs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing string on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogsStream( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogs.createStream( - this.innerApiCalls.listLogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name to list logs for: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {string[]} [request.resourceNames] - * Optional. List of resource names to list logs for: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * The resource name in the `parent` field is added to this list. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.list_logs.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async - */ - listLogsAsync( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogs.asyncIterate( - this.innerApiCalls['listLogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.loggingServiceV2Stub && !this._terminated) { - return this.loggingServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json deleted file mode 100644 index 342e96e9..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_client_config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.LoggingServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "DeleteLog": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "WriteLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default", - "bundling": { - "element_count_threshold": 1000, - "request_byte_threshold": 1048576, - "delay_threshold_millis": 50, - "element_count_limit": 1000000 - } - }, - "ListLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListMonitoredResourceDescriptors": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListLogs": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "TailLogEntries": { - "timeout_millis": 3600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/logging_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts b/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts deleted file mode 100644 index 39c5205d..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_client.ts +++ /dev/null @@ -1,2288 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/metrics_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './metrics_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring logs-based metrics. - * @class - * @memberof v2 - */ -export class MetricsServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricsServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricsServiceV2Client. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new MetricsServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricsServiceV2Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/links/{link}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listLogMetrics: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.metricsServiceV2Stub) { - return this.metricsServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.MetricsServiceV2. - this.metricsServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.MetricsServiceV2, - 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 metricsServiceV2StubMethods = - ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; - for (const methodName of metricsServiceV2StubMethods) { - const callPromise = this.metricsServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.metricsServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'logging.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 'logging.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/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - 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 -- - // ------------------- -/** - * Gets a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the desired metric: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async - */ - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLogMetric(request, options, callback); - } -/** - * Creates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project in which to create the metric: - * - * "projects/[PROJECT_ID]" - * - * The new metric must be provided in the request. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async - */ - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createLogMetric(request, options, callback); - } -/** - * Creates or updates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to update: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The updated metric. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async - */ - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateLogMetric(request, options, callback); - } -/** - * Deletes a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to delete: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async - */ - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteLogMetric(request, options, callback); - } - - /** - * Lists logs-based metrics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLogMetrics(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.logging.v2.LogMetric|LogMetric} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLogMetricsStream( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogMetrics.createStream( - this.innerApiCalls.listLogMetrics as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogMetrics`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.logging.v2.LogMetric|LogMetric}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.list_log_metrics.js - * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async - */ - listLogMetricsAsync( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listLogMetrics.asyncIterate( - this.innerApiCalls['listLogMetrics'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketLink resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - billingAccountLocationBucketLinkPath(billingAccount:string,location:string,bucket:string,link:string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; - } - - /** - * Parse the link from BillingAccountLocationBucketLink resource. - * - * @param {string} billingAccountLocationBucketLinkName - * A fully-qualified path representing billing_account_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName: string) { - return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketLink resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - folderLocationBucketLinkPath(folder:string,location:string,bucket:string,link:string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the folder from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; - } - - /** - * Parse the location from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; - } - - /** - * Parse the bucket from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; - } - - /** - * Parse the link from FolderLocationBucketLink resource. - * - * @param {string} folderLocationBucketLinkName - * A fully-qualified path representing folder_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName: string) { - return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketLink resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - organizationLocationBucketLinkPath(organization:string,location:string,bucket:string,link:string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; - } - - /** - * Parse the link from OrganizationLocationBucketLink resource. - * - * @param {string} organizationLocationBucketLinkName - * A fully-qualified path representing organization_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName: string) { - return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} link - * @returns {string} Resource name string. - */ - projectLocationBucketLinkPath(project:string,location:string,bucket:string,link:string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - link: link, - }); - } - - /** - * Parse the project from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; - } - - /** - * Parse the location from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; - } - - /** - * Parse the link from ProjectLocationBucketLink resource. - * - * @param {string} projectLocationBucketLinkName - * A fully-qualified path representing project_location_bucket_link resource. - * @returns {string} A string representing the link. - */ - matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName: string) { - return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * 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.metricsServiceV2Stub && !this._terminated) { - return this.metricsServiceV2Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json deleted file mode 100644 index 014688ab..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.MetricsServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "ListLogMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json b/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json deleted file mode 100644 index fd41d3bf..00000000 --- a/owl-bot-staging/v2/src/v2/metrics_service_v2_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.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 e3fe4bd9..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const logging = require('@google-cloud/logging'); - -function main() { - const configServiceV2Client = new logging.ConfigServiceV2Client(); - const loggingServiceV2Client = new logging.LoggingServiceV2Client(); - const metricsServiceV2Client = new logging.MetricsServiceV2Client(); -} - -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 a8f19533..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from '@google-cloud/logging'; - -// check that the client class type name can be used -function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { - client.close(); -} -function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { - client.close(); -} -function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const configServiceV2Client = new ConfigServiceV2Client(); - doStuffWithConfigServiceV2Client(configServiceV2Client); - // check that the client instance can be created - const loggingServiceV2Client = new LoggingServiceV2Client(); - doStuffWithLoggingServiceV2Client(loggingServiceV2Client); - // check that the client instance can be created - const metricsServiceV2Client = new MetricsServiceV2Client(); - doStuffWithMetricsServiceV2Client(metricsServiceV2Client); -} - -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 c8f81b25..00000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts deleted file mode 100644 index 1d67fad1..00000000 --- a/owl-bot-staging/v2/test/gapic_config_service_v2_v2.ts +++ /dev/null @@ -1,6220 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as configservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConfigServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = configservicev2Module.v2.ConfigServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - await client.initialize(); - assert(client.configServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.configServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - 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 configservicev2Module.v2.ConfigServiceV2Client({ - 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('getBucket', () => { - it('invokes getBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); - const [response] = await client.getBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBucket(request), expectedError); - }); - }); - - describe('createBucket', () => { - it('invokes createBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); - const [response] = await client.createBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBucket(request), expectedError); - }); - }); - - describe('updateBucket', () => { - it('invokes updateBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); - const [response] = await client.updateBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBucket(request), expectedError); - }); - }); - - describe('deleteBucket', () => { - it('invokes deleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBucket(request), expectedError); - }); - }); - - describe('undeleteBucket', () => { - it('invokes undeleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.undeleteBucket(request), expectedError); - }); - }); - - describe('getView', () => { - it('invokes getView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCall(expectedResponse); - const [response] = await client.getView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getView(request), expectedError); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getView(request), expectedError); - }); - }); - - describe('createView', () => { - it('invokes createView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCall(expectedResponse); - const [response] = await client.createView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createView(request), expectedError); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createView(request), expectedError); - }); - }); - - describe('updateView', () => { - it('invokes updateView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); - const [response] = await client.updateView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateView(request), expectedError); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateView(request), expectedError); - }); - }); - - describe('deleteView', () => { - it('invokes deleteView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); - const [response] = await client.deleteView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteView( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteView(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteView(request), expectedError); - }); - }); - - describe('getSink', () => { - it('invokes getSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); - const [response] = await client.getSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSink(request), expectedError); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSink(request), expectedError); - }); - }); - - describe('createSink', () => { - it('invokes createSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); - const [response] = await client.createSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSink(request), expectedError); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSink(request), expectedError); - }); - }); - - describe('updateSink', () => { - it('invokes updateSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); - const [response] = await client.updateSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSink(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSink(request), expectedError); - }); - }); - - describe('deleteSink', () => { - it('invokes deleteSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSink(request), expectedError); - }); - }); - - describe('getLink', () => { - it('invokes getLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Link() - ); - client.innerApiCalls.getLink = stubSimpleCall(expectedResponse); - const [response] = await client.getLink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Link() - ); - client.innerApiCalls.getLink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLink(request), expectedError); - const actualRequest = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLinkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLink(request), expectedError); - }); - }); - - describe('getExclusion', () => { - it('invokes getExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.getExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExclusion(request), expectedError); - }); - }); - - describe('createExclusion', () => { - it('invokes createExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.createExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExclusion(request), expectedError); - }); - }); - - describe('updateExclusion', () => { - it('invokes updateExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.updateExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateExclusion(request), expectedError); - }); - }); - - describe('deleteExclusion', () => { - it('invokes deleteExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExclusion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteExclusion(request), expectedError); - }); - }); - - describe('getCmekSettings', () => { - it('invokes getCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCmekSettings(request), expectedError); - }); - }); - - describe('updateCmekSettings', () => { - it('invokes updateCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCmekSettings(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSettings(request), expectedError); - }); - }); - - describe('createBucketAsync', () => { - it('invokes createBucketAsync without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBucketAsync(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBucketAsync = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucketAsync( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBucketAsync(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucketAsync with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBucketAsync(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBucketAsyncProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBucketAsyncProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBucketAsyncProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBucketAsyncProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBucketAsync', () => { - it('invokes updateBucketAsync without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBucketAsync(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBucketAsync = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucketAsync( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBucketAsync(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucketAsync with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucketAsync = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBucketAsync(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucketAsync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateBucketAsyncProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateBucketAsyncProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBucketAsyncProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBucketAsyncProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createLink', () => { - it('invokes createLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.createLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createLink(request), expectedError); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLink with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateLinkProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateLinkProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteLink', () => { - it('invokes deleteLink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteLink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLink with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteLinkProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteLinkProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('copyLogEntries', () => { - it('invokes copyLogEntries without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); - const [operation] = await client.copyLogEntries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.copyLogEntries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.copyLogEntries(request), expectedError); - }); - - it('invokes copyLogEntries with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.copyLogEntries(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkCopyLogEntriesProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCopyLogEntriesProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuckets', () => { - it('invokes listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); - const [response] = await client.listBuckets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuckets( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuckets(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBucketsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBucketsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogBucket[] = []; - const iterable = client.listBucketsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBucketsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogBucket[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listViews', () => { - it('invokes listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); - const [response] = await client.listViews(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listViews( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listViews(request), expectedError); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViewsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listViewsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogView[] = []; - const iterable = client.listViewsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listViewsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogView[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSinks', () => { - it('invokes listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); - const [response] = await client.listSinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogSink[] = []; - const iterable = client.listSinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogSink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listLinks', () => { - it('invokes listLinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.innerApiCalls.listLinks = stubSimpleCall(expectedResponse); - const [response] = await client.listLinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.innerApiCalls.listLinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.descriptors.page.listLinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.Link[] = []; - stream.on('data', (response: protos.google.logging.v2.Link) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); - assert( - (client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.Link[] = []; - stream.on('data', (response: protos.google.logging.v2.Link) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLinks, request)); - assert( - (client.descriptors.page.listLinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - generateSampleMessage(new protos.google.logging.v2.Link()), - ]; - client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILink[] = []; - const iterable = client.listLinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listExclusions', () => { - it('invokes listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); - const [response] = await client.listExclusions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExclusions( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExclusions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusionsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExclusionsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogExclusion[] = []; - const iterable = client.listExclusionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExclusionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogExclusion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts deleted file mode 100644 index 268928df..00000000 --- a/owl-bot-staging/v2/test/gapic_logging_service_v2_v2.ts +++ /dev/null @@ -1,2415 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as loggingservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.LoggingServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - await client.initialize(); - assert(client.loggingServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.loggingServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - 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 loggingservicev2Module.v2.LoggingServiceV2Client({ - 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('deleteLog', () => { - it('invokes deleteLog without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLog( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLog(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteLog(request), expectedError); - }); - }); - - describe('writeLogEntries', () => { - it('invokes writeLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.writeLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - - it('invokes writeLogEntries with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - }); - - describe('tailLogEntries', () => { - it('invokes tailLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesResponse() - ); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes tailLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('listLogEntries', () => { - it('invokes listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.listLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogEntries(request), expectedError); - }); - - it('invokes listLogEntriesStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('invokes listLogEntriesStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('uses async iteration with listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogEntry[] = []; - const iterable = client.listLogEntriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogEntriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listLogs', () => { - it('invokes listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); - const [response] = await client.listLogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogs( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.listLogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts b/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts deleted file mode 100644 index 6904bceb..00000000 --- a/owl-bot-staging/v2/test/gapic_metrics_service_v2_v2.ts +++ /dev/null @@ -1,2257 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricsservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.MetricsServiceV2Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - await client.initialize(); - assert(client.metricsServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.metricsServiceV2Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - 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 metricsservicev2Module.v2.MetricsServiceV2Client({ - 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('getLogMetric', () => { - it('invokes getLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.getLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLogMetric(request), expectedError); - }); - }); - - describe('createLogMetric', () => { - it('invokes createLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.createLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createLogMetric(request), expectedError); - }); - }); - - describe('updateLogMetric', () => { - it('invokes updateLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.updateLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateLogMetric(request), expectedError); - }); - }); - - describe('deleteLogMetric', () => { - it('invokes deleteLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLogMetric( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteLogMetric(request), expectedError); - }); - }); - - describe('listLogMetrics', () => { - it('invokes listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); - const [response] = await client.listLogMetrics(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogMetrics( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetricsStream without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogMetricsStream with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogMetric[] = []; - const iterable = client.listLogMetricsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogMetricsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogMetric[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketLink', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketLink"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketLinkPath', () => { - const result = client.billingAccountLocationBucketLinkPath("billingAccountValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromBillingAccountLocationBucketLinkName', () => { - const result = client.matchLinkFromBillingAccountLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketLink', () => { - const fakePath = "/rendered/path/folderLocationBucketLink"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketLinkPath', () => { - const result = client.folderLocationBucketLinkPath("folderValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketLinkName', () => { - const result = client.matchFolderFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketLinkName', () => { - const result = client.matchLocationFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketLinkName', () => { - const result = client.matchBucketFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromFolderLocationBucketLinkName', () => { - const result = client.matchLinkFromFolderLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.folderLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketLink', () => { - const fakePath = "/rendered/path/organizationLocationBucketLink"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketLinkPath', () => { - const result = client.organizationLocationBucketLinkPath("organizationValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLocationFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketLinkName', () => { - const result = client.matchBucketFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromOrganizationLocationBucketLinkName', () => { - const result = client.matchLinkFromOrganizationLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.organizationLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketLink', () => { - const fakePath = "/rendered/path/projectLocationBucketLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - link: "linkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketLinkPath', () => { - const result = client.projectLocationBucketLinkPath("projectValue", "locationValue", "bucketValue", "linkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketLinkName', () => { - const result = client.matchProjectFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketLinkName', () => { - const result = client.matchLocationFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketLinkName', () => { - const result = client.matchBucketFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLinkFromProjectLocationBucketLinkName', () => { - const result = client.matchLinkFromProjectLocationBucketLinkName(fakePath); - assert.strictEqual(result, "linkValue"); - assert((client.pathTemplates.projectLocationBucketLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- 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 a37e80e5..00000000 --- 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: 'logging', - filename: './logging.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 db396b28b54593a2ff364a99f1442415b193e9de Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 11 Oct 2023 14:00:07 +0000 Subject: [PATCH 5/5] =?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 --- ...logging_service_v2.list_monitored_resource_descriptors.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js b/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js index 2d05df22..76cc75e4 100644 --- a/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js +++ b/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js @@ -51,9 +51,8 @@ function main() { const request = {}; // Run request - const iterable = await loggingClient.listMonitoredResourceDescriptorsAsync( - request - ); + const iterable = + await loggingClient.listMonitoredResourceDescriptorsAsync(request); for await (const response of iterable) { console.log(response); }