diff --git a/handwritten/logging/.OwlBot.yaml b/handwritten/logging/.OwlBot.yaml deleted file mode 100644 index 360ece41c701..000000000000 --- a/handwritten/logging/.OwlBot.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -deep-remove-regex: - - /owl-bot-staging - -deep-copy-regex: - - source: /google/logging/(v.*)/.*-nodejs - dest: /owl-bot-staging/logging/$1 - -begin-after-commit-hash: fb91803ccef5d7c695139b22788b309e2197856b - diff --git a/handwritten/logging/owlbot.py b/handwritten/logging/owlbot.py deleted file mode 100644 index 2f695937b908..000000000000 --- a/handwritten/logging/owlbot.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.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. - -"""This script is used to synthesize generated parts of this library.""" - -import os -import synthtool as s -import synthtool.languages.node_mono_repo as node - -node.owlbot_main(relative_dir="handwritten/logging", - staging_excludes=[ - ".eslintignore", ".prettierignore", "src/index.ts", "README.md", "package.json", - "system-test/fixtures/sample/src/index.js", - "system-test/fixtures/sample/src/index.ts"], - templates_excludes=[ - "src/index.ts", - ".eslintignore", - ".prettierignore", - "CONTRIBUTING.md", - ".github/auto-label.yaml", - ".github/release-please.yml", - ".github/CODEOWNERS", - ".github/sync-repo-settings.yaml", - "README.md", - ".kokoro/system-test.sh", - ".kokoro/continuous/node14/system-test.cfg", - ".kokoro/presubmit/node14/system-test.cfg" - ] -) - -# adjust .trampolinerc for environment tests -s.replace( - "handwritten/logging/.trampolinerc", - r"required_envvars[^\)]*\)", - "required_envvars+=()" -) -s.replace( - "handwritten/logging/.trampolinerc", - r"pass_down_envvars\+\=\((?!\s*\"ENVIRONMENT\")", - 'pass_down_envvars+=(\n "ENVIRONMENT"\n "RUNTIME"' -) - -# -------------------------------------------------------------------------- -# Modify test configs -# -------------------------------------------------------------------------- - -# add shared environment variables to test configs -s.move( - "handwritten/logging/.kokoro/common_env_vars.cfg", - "handwritten/logging/.kokoro/common.cfg", - merge=lambda src, dst, _: dst if src.strip() in dst else f"{dst.rstrip()}\n{src.strip()}\n", -) - -for path, subdirs, files in os.walk(f"handwritten/logging/.kokoro/continuous"): - for name in files: - if name == "common.cfg": - file_path = os.path.join(path, name) - s.move( - "handwritten/logging/.kokoro/common_env_vars.cfg", - file_path, - merge=lambda src, dst, _: dst if src.strip() in dst else f"{dst.rstrip()}\n{src.strip()}\n", - ) diff --git a/handwritten/logging/package.json b/handwritten/logging/package.json index f94c60f16dc6..40442d85c591 100644 --- a/handwritten/logging/package.json +++ b/handwritten/logging/package.json @@ -62,7 +62,8 @@ "long": "^5.3.2", "on-finished": "^2.3.0", "pumpify": "^2.0.1", - "stream-events": "^1.0.5" + "stream-events": "^1.0.5", + "@google-cloud/logging-api": "^0.2.0" }, "devDependencies": { "@google-cloud/bigquery": "^7.0.0", diff --git a/handwritten/logging/protos/protos.json b/handwritten/logging/protos/protos.json index cf79e8a61729..9e26dfeeb6e6 100644 --- a/handwritten/logging/protos/protos.json +++ b/handwritten/logging/protos/protos.json @@ -1,6082 +1 @@ -{ - "nested": { - "google": { - "nested": { - "protobuf": { - "options": { - "go_package": "google.golang.org/protobuf/types/descriptorpb", - "java_package": "com.google.protobuf", - "java_outer_classname": "DescriptorProtos", - "csharp_namespace": "Google.Protobuf.Reflection", - "objc_class_prefix": "GPB", - "cc_enable_arenas": true, - "optimize_for": "SPEED" - }, - "nested": { - "Duration": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "FileDescriptorSet": { - "edition": "proto2", - "fields": { - "file": { - "rule": "repeated", - "type": "FileDescriptorProto", - "id": 1 - } - }, - "extensions": [ - [ - 536000000, - 536000000 - ] - ] - }, - "Edition": { - "edition": "proto2", - "values": { - "EDITION_UNKNOWN": 0, - "EDITION_LEGACY": 900, - "EDITION_PROTO2": 998, - "EDITION_PROTO3": 999, - "EDITION_2023": 1000, - "EDITION_2024": 1001, - "EDITION_1_TEST_ONLY": 1, - "EDITION_2_TEST_ONLY": 2, - "EDITION_99997_TEST_ONLY": 99997, - "EDITION_99998_TEST_ONLY": 99998, - "EDITION_99999_TEST_ONLY": 99999, - "EDITION_MAX": 2147483647 - } - }, - "FileDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "package": { - "type": "string", - "id": 2 - }, - "dependency": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "publicDependency": { - "rule": "repeated", - "type": "int32", - "id": 10 - }, - "weakDependency": { - "rule": "repeated", - "type": "int32", - "id": 11 - }, - "optionDependency": { - "rule": "repeated", - "type": "string", - "id": 15 - }, - "messageType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 4 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 5 - }, - "service": { - "rule": "repeated", - "type": "ServiceDescriptorProto", - "id": 6 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 7 - }, - "options": { - "type": "FileOptions", - "id": 8 - }, - "sourceCodeInfo": { - "type": "SourceCodeInfo", - "id": 9 - }, - "syntax": { - "type": "string", - "id": 12 - }, - "edition": { - "type": "Edition", - "id": 14 - } - } - }, - "DescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "field": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 2 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 6 - }, - "nestedType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 3 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 4 - }, - "extensionRange": { - "rule": "repeated", - "type": "ExtensionRange", - "id": 5 - }, - "oneofDecl": { - "rule": "repeated", - "type": "OneofDescriptorProto", - "id": 8 - }, - "options": { - "type": "MessageOptions", - "id": 7 - }, - "reservedRange": { - "rule": "repeated", - "type": "ReservedRange", - "id": 9 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 10 - }, - "visibility": { - "type": "SymbolVisibility", - "id": 11 - } - }, - "nested": { - "ExtensionRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "ExtensionRangeOptions", - "id": 3 - } - } - }, - "ReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "ExtensionRangeOptions": { - "edition": "proto2", - "fields": { - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - }, - "declaration": { - "rule": "repeated", - "type": "Declaration", - "id": 2, - "options": { - "retention": "RETENTION_SOURCE" - } - }, - "features": { - "type": "FeatureSet", - "id": 50 - }, - "verification": { - "type": "VerificationState", - "id": 3, - "options": { - "default": "UNVERIFIED", - "retention": "RETENTION_SOURCE" - } - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "nested": { - "Declaration": { - "fields": { - "number": { - "type": "int32", - "id": 1 - }, - "fullName": { - "type": "string", - "id": 2 - }, - "type": { - "type": "string", - "id": 3 - }, - "reserved": { - "type": "bool", - "id": 5 - }, - "repeated": { - "type": "bool", - "id": 6 - } - }, - "reserved": [ - [ - 4, - 4 - ] - ] - }, - "VerificationState": { - "values": { - "DECLARATION": 0, - "UNVERIFIED": 1 - } - } - } - }, - "FieldDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 3 - }, - "label": { - "type": "Label", - "id": 4 - }, - "type": { - "type": "Type", - "id": 5 - }, - "typeName": { - "type": "string", - "id": 6 - }, - "extendee": { - "type": "string", - "id": 2 - }, - "defaultValue": { - "type": "string", - "id": 7 - }, - "oneofIndex": { - "type": "int32", - "id": 9 - }, - "jsonName": { - "type": "string", - "id": 10 - }, - "options": { - "type": "FieldOptions", - "id": 8 - }, - "proto3Optional": { - "type": "bool", - "id": 17 - } - }, - "nested": { - "Type": { - "values": { - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18 - } - }, - "Label": { - "values": { - "LABEL_OPTIONAL": 1, - "LABEL_REPEATED": 3, - "LABEL_REQUIRED": 2 - } - } - } - }, - "OneofDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "options": { - "type": "OneofOptions", - "id": 2 - } - } - }, - "EnumDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "rule": "repeated", - "type": "EnumValueDescriptorProto", - "id": 2 - }, - "options": { - "type": "EnumOptions", - "id": 3 - }, - "reservedRange": { - "rule": "repeated", - "type": "EnumReservedRange", - "id": 4 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 5 - }, - "visibility": { - "type": "SymbolVisibility", - "id": 6 - } - }, - "nested": { - "EnumReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "EnumValueDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "EnumValueOptions", - "id": 3 - } - } - }, - "ServiceDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "method": { - "rule": "repeated", - "type": "MethodDescriptorProto", - "id": 2 - }, - "options": { - "type": "ServiceOptions", - "id": 3 - } - }, - "reserved": [ - [ - 4, - 4 - ], - "stream" - ] - }, - "MethodDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "inputType": { - "type": "string", - "id": 2 - }, - "outputType": { - "type": "string", - "id": 3 - }, - "options": { - "type": "MethodOptions", - "id": 4 - }, - "clientStreaming": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "serverStreaming": { - "type": "bool", - "id": 6, - "options": { - "default": false - } - } - } - }, - "FileOptions": { - "edition": "proto2", - "fields": { - "javaPackage": { - "type": "string", - "id": 1 - }, - "javaOuterClassname": { - "type": "string", - "id": 8 - }, - "javaMultipleFiles": { - "type": "bool", - "id": 10, - "options": { - "default": false - } - }, - "javaGenerateEqualsAndHash": { - "type": "bool", - "id": 20, - "options": { - "deprecated": true - } - }, - "javaStringCheckUtf8": { - "type": "bool", - "id": 27, - "options": { - "default": false - } - }, - "optimizeFor": { - "type": "OptimizeMode", - "id": 9, - "options": { - "default": "SPEED" - } - }, - "goPackage": { - "type": "string", - "id": 11 - }, - "ccGenericServices": { - "type": "bool", - "id": 16, - "options": { - "default": false - } - }, - "javaGenericServices": { - "type": "bool", - "id": 17, - "options": { - "default": false - } - }, - "pyGenericServices": { - "type": "bool", - "id": 18, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 23, - "options": { - "default": false - } - }, - "ccEnableArenas": { - "type": "bool", - "id": 31, - "options": { - "default": true - } - }, - "objcClassPrefix": { - "type": "string", - "id": 36 - }, - "csharpNamespace": { - "type": "string", - "id": 37 - }, - "swiftPrefix": { - "type": "string", - "id": 39 - }, - "phpClassPrefix": { - "type": "string", - "id": 40 - }, - "phpNamespace": { - "type": "string", - "id": 41 - }, - "phpMetadataNamespace": { - "type": "string", - "id": 44 - }, - "rubyPackage": { - "type": "string", - "id": 45 - }, - "features": { - "type": "FeatureSet", - "id": 50 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 42, - 42 - ], - "php_generic_services", - [ - 38, - 38 - ] - ], - "nested": { - "OptimizeMode": { - "values": { - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3 - } - } - } - }, - "MessageOptions": { - "edition": "proto2", - "fields": { - "messageSetWireFormat": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "noStandardDescriptorAccessor": { - "type": "bool", - "id": 2, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "mapEntry": { - "type": "bool", - "id": 7 - }, - "deprecatedLegacyJsonFieldConflicts": { - "type": "bool", - "id": 11, - "options": { - "deprecated": true - } - }, - "features": { - "type": "FeatureSet", - "id": 12 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ], - [ - 5, - 5 - ], - [ - 6, - 6 - ], - [ - 8, - 8 - ], - [ - 9, - 9 - ] - ] - }, - "FieldOptions": { - "edition": "proto2", - "fields": { - "ctype": { - "type": "CType", - "id": 1, - "options": { - "default": "STRING" - } - }, - "packed": { - "type": "bool", - "id": 2 - }, - "jstype": { - "type": "JSType", - "id": 6, - "options": { - "default": "JS_NORMAL" - } - }, - "lazy": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "unverifiedLazy": { - "type": "bool", - "id": 15, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "weak": { - "type": "bool", - "id": 10, - "options": { - "default": false, - "deprecated": true - } - }, - "debugRedact": { - "type": "bool", - "id": 16, - "options": { - "default": false - } - }, - "retention": { - "type": "OptionRetention", - "id": 17 - }, - "targets": { - "rule": "repeated", - "type": "OptionTargetType", - "id": 19 - }, - "editionDefaults": { - "rule": "repeated", - "type": "EditionDefault", - "id": 20 - }, - "features": { - "type": "FeatureSet", - "id": 21 - }, - "featureSupport": { - "type": "FeatureSupport", - "id": 22 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ], - [ - 18, - 18 - ] - ], - "nested": { - "CType": { - "values": { - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2 - } - }, - "JSType": { - "values": { - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2 - } - }, - "OptionRetention": { - "values": { - "RETENTION_UNKNOWN": 0, - "RETENTION_RUNTIME": 1, - "RETENTION_SOURCE": 2 - } - }, - "OptionTargetType": { - "values": { - "TARGET_TYPE_UNKNOWN": 0, - "TARGET_TYPE_FILE": 1, - "TARGET_TYPE_EXTENSION_RANGE": 2, - "TARGET_TYPE_MESSAGE": 3, - "TARGET_TYPE_FIELD": 4, - "TARGET_TYPE_ONEOF": 5, - "TARGET_TYPE_ENUM": 6, - "TARGET_TYPE_ENUM_ENTRY": 7, - "TARGET_TYPE_SERVICE": 8, - "TARGET_TYPE_METHOD": 9 - } - }, - "EditionDefault": { - "fields": { - "edition": { - "type": "Edition", - "id": 3 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "FeatureSupport": { - "fields": { - "editionIntroduced": { - "type": "Edition", - "id": 1 - }, - "editionDeprecated": { - "type": "Edition", - "id": 2 - }, - "deprecationWarning": { - "type": "string", - "id": 3 - }, - "editionRemoved": { - "type": "Edition", - "id": 4 - } - } - } - } - }, - "OneofOptions": { - "edition": "proto2", - "fields": { - "features": { - "type": "FeatureSet", - "id": 1 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "EnumOptions": { - "edition": "proto2", - "fields": { - "allowAlias": { - "type": "bool", - "id": 2 - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "deprecatedLegacyJsonFieldConflicts": { - "type": "bool", - "id": 6, - "options": { - "deprecated": true - } - }, - "features": { - "type": "FeatureSet", - "id": 7 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 5, - 5 - ] - ] - }, - "EnumValueOptions": { - "edition": "proto2", - "fields": { - "deprecated": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "features": { - "type": "FeatureSet", - "id": 2 - }, - "debugRedact": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "featureSupport": { - "type": "FieldOptions.FeatureSupport", - "id": 4 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "ServiceOptions": { - "edition": "proto2", - "fields": { - "features": { - "type": "FeatureSet", - "id": 34 - }, - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "MethodOptions": { - "edition": "proto2", - "fields": { - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "idempotencyLevel": { - "type": "IdempotencyLevel", - "id": 34, - "options": { - "default": "IDEMPOTENCY_UNKNOWN" - } - }, - "features": { - "type": "FeatureSet", - "id": 35 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "nested": { - "IdempotencyLevel": { - "values": { - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2 - } - } - } - }, - "UninterpretedOption": { - "edition": "proto2", - "fields": { - "name": { - "rule": "repeated", - "type": "NamePart", - "id": 2 - }, - "identifierValue": { - "type": "string", - "id": 3 - }, - "positiveIntValue": { - "type": "uint64", - "id": 4 - }, - "negativeIntValue": { - "type": "int64", - "id": 5 - }, - "doubleValue": { - "type": "double", - "id": 6 - }, - "stringValue": { - "type": "bytes", - "id": 7 - }, - "aggregateValue": { - "type": "string", - "id": 8 - } - }, - "nested": { - "NamePart": { - "fields": { - "namePart": { - "rule": "required", - "type": "string", - "id": 1 - }, - "isExtension": { - "rule": "required", - "type": "bool", - "id": 2 - } - } - } - } - }, - "FeatureSet": { - "edition": "proto2", - "fields": { - "fieldPresence": { - "type": "FieldPresence", - "id": 1, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_2023", - "edition_defaults.value": "EXPLICIT" - } - }, - "enumType": { - "type": "EnumType", - "id": 2, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "OPEN" - } - }, - "repeatedFieldEncoding": { - "type": "RepeatedFieldEncoding", - "id": 3, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "PACKED" - } - }, - "utf8Validation": { - "type": "Utf8Validation", - "id": 4, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "VERIFY" - } - }, - "messageEncoding": { - "type": "MessageEncoding", - "id": 5, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_LEGACY", - "edition_defaults.value": "LENGTH_PREFIXED" - } - }, - "jsonFormat": { - "type": "JsonFormat", - "id": 6, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "ALLOW" - } - }, - "enforceNamingStyle": { - "type": "EnforceNamingStyle", - "id": 7, - "options": { - "retention": "RETENTION_SOURCE", - "targets": "TARGET_TYPE_METHOD", - "feature_support.edition_introduced": "EDITION_2024", - "edition_defaults.edition": "EDITION_2024", - "edition_defaults.value": "STYLE2024" - } - }, - "defaultSymbolVisibility": { - "type": "VisibilityFeature.DefaultSymbolVisibility", - "id": 8, - "options": { - "retention": "RETENTION_SOURCE", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2024", - "edition_defaults.edition": "EDITION_2024", - "edition_defaults.value": "EXPORT_TOP_LEVEL" - } - } - }, - "extensions": [ - [ - 1000, - 9994 - ], - [ - 9995, - 9999 - ], - [ - 10000, - 10000 - ] - ], - "reserved": [ - [ - 999, - 999 - ] - ], - "nested": { - "FieldPresence": { - "values": { - "FIELD_PRESENCE_UNKNOWN": 0, - "EXPLICIT": 1, - "IMPLICIT": 2, - "LEGACY_REQUIRED": 3 - } - }, - "EnumType": { - "values": { - "ENUM_TYPE_UNKNOWN": 0, - "OPEN": 1, - "CLOSED": 2 - } - }, - "RepeatedFieldEncoding": { - "values": { - "REPEATED_FIELD_ENCODING_UNKNOWN": 0, - "PACKED": 1, - "EXPANDED": 2 - } - }, - "Utf8Validation": { - "values": { - "UTF8_VALIDATION_UNKNOWN": 0, - "VERIFY": 2, - "NONE": 3 - }, - "reserved": [ - [ - 1, - 1 - ] - ] - }, - "MessageEncoding": { - "values": { - "MESSAGE_ENCODING_UNKNOWN": 0, - "LENGTH_PREFIXED": 1, - "DELIMITED": 2 - } - }, - "JsonFormat": { - "values": { - "JSON_FORMAT_UNKNOWN": 0, - "ALLOW": 1, - "LEGACY_BEST_EFFORT": 2 - } - }, - "EnforceNamingStyle": { - "values": { - "ENFORCE_NAMING_STYLE_UNKNOWN": 0, - "STYLE2024": 1, - "STYLE_LEGACY": 2 - } - }, - "VisibilityFeature": { - "fields": {}, - "reserved": [ - [ - 1, - 536870911 - ] - ], - "nested": { - "DefaultSymbolVisibility": { - "values": { - "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, - "EXPORT_ALL": 1, - "EXPORT_TOP_LEVEL": 2, - "LOCAL_ALL": 3, - "STRICT": 4 - } - } - } - } - } - }, - "FeatureSetDefaults": { - "edition": "proto2", - "fields": { - "defaults": { - "rule": "repeated", - "type": "FeatureSetEditionDefault", - "id": 1 - }, - "minimumEdition": { - "type": "Edition", - "id": 4 - }, - "maximumEdition": { - "type": "Edition", - "id": 5 - } - }, - "nested": { - "FeatureSetEditionDefault": { - "fields": { - "edition": { - "type": "Edition", - "id": 3 - }, - "overridableFeatures": { - "type": "FeatureSet", - "id": 4 - }, - "fixedFeatures": { - "type": "FeatureSet", - "id": 5 - } - }, - "reserved": [ - [ - 1, - 1 - ], - [ - 2, - 2 - ], - "features" - ] - } - } - }, - "SourceCodeInfo": { - "edition": "proto2", - "fields": { - "location": { - "rule": "repeated", - "type": "Location", - "id": 1 - } - }, - "extensions": [ - [ - 536000000, - 536000000 - ] - ], - "nested": { - "Location": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1, - "options": { - "packed": true - } - }, - "span": { - "rule": "repeated", - "type": "int32", - "id": 2, - "options": { - "packed": true - } - }, - "leadingComments": { - "type": "string", - "id": 3 - }, - "trailingComments": { - "type": "string", - "id": 4 - }, - "leadingDetachedComments": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - } - } - }, - "GeneratedCodeInfo": { - "edition": "proto2", - "fields": { - "annotation": { - "rule": "repeated", - "type": "Annotation", - "id": 1 - } - }, - "nested": { - "Annotation": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1, - "options": { - "packed": true - } - }, - "sourceFile": { - "type": "string", - "id": 2 - }, - "begin": { - "type": "int32", - "id": 3 - }, - "end": { - "type": "int32", - "id": 4 - }, - "semantic": { - "type": "Semantic", - "id": 5 - } - }, - "nested": { - "Semantic": { - "values": { - "NONE": 0, - "SET": 1, - "ALIAS": 2 - } - } - } - } - } - }, - "SymbolVisibility": { - "edition": "proto2", - "values": { - "VISIBILITY_UNSET": 0, - "VISIBILITY_LOCAL": 1, - "VISIBILITY_EXPORT": 2 - } - }, - "Struct": { - "fields": { - "fields": { - "keyType": "string", - "type": "Value", - "id": 1 - } - } - }, - "Value": { - "oneofs": { - "kind": { - "oneof": [ - "nullValue", - "numberValue", - "stringValue", - "boolValue", - "structValue", - "listValue" - ] - } - }, - "fields": { - "nullValue": { - "type": "NullValue", - "id": 1 - }, - "numberValue": { - "type": "double", - "id": 2 - }, - "stringValue": { - "type": "string", - "id": 3 - }, - "boolValue": { - "type": "bool", - "id": 4 - }, - "structValue": { - "type": "Struct", - "id": 5 - }, - "listValue": { - "type": "ListValue", - "id": 6 - } - } - }, - "NullValue": { - "values": { - "NULL_VALUE": 0 - } - }, - "ListValue": { - "fields": { - "values": { - "rule": "repeated", - "type": "Value", - "id": 1 - } - } - }, - "Any": { - "fields": { - "type_url": { - "type": "string", - "id": 1 - }, - "value": { - "type": "bytes", - "id": 2 - } - } - }, - "Timestamp": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "Empty": { - "fields": {} - }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - } - } - }, - "logging": { - "nested": { - "type": { - "options": { - "csharp_namespace": "Google.Cloud.Logging.Type", - "go_package": "google.golang.org/genproto/googleapis/logging/type;ltype", - "java_multiple_files": true, - "java_outer_classname": "LogSeverityProto", - "java_package": "com.google.logging.type", - "php_namespace": "Google\\Cloud\\Logging\\Type", - "ruby_package": "Google::Cloud::Logging::Type", - "objc_class_prefix": "GLOG" - }, - "nested": { - "HttpRequest": { - "fields": { - "requestMethod": { - "type": "string", - "id": 1 - }, - "requestUrl": { - "type": "string", - "id": 2 - }, - "requestSize": { - "type": "int64", - "id": 3 - }, - "status": { - "type": "int32", - "id": 4 - }, - "responseSize": { - "type": "int64", - "id": 5 - }, - "userAgent": { - "type": "string", - "id": 6 - }, - "remoteIp": { - "type": "string", - "id": 7 - }, - "serverIp": { - "type": "string", - "id": 13 - }, - "referer": { - "type": "string", - "id": 8 - }, - "latency": { - "type": "google.protobuf.Duration", - "id": 14 - }, - "cacheLookup": { - "type": "bool", - "id": 11 - }, - "cacheHit": { - "type": "bool", - "id": 9 - }, - "cacheValidatedWithOriginServer": { - "type": "bool", - "id": 10 - }, - "cacheFillBytes": { - "type": "int64", - "id": 12 - }, - "protocol": { - "type": "string", - "id": 15 - } - } - }, - "LogSeverity": { - "values": { - "DEFAULT": 0, - "DEBUG": 100, - "INFO": 200, - "NOTICE": 300, - "WARNING": 400, - "ERROR": 500, - "CRITICAL": 600, - "ALERT": 700, - "EMERGENCY": 800 - } - } - } - }, - "v2": { - "options": { - "cc_enable_arenas": true, - "csharp_namespace": "Google.Cloud.Logging.V2", - "go_package": "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb", - "java_multiple_files": true, - "java_outer_classname": "LoggingMetricsProto", - "java_package": "com.google.logging.v2", - "php_namespace": "Google\\Cloud\\Logging\\V2", - "ruby_package": "Google::Cloud::Logging::V2", - "(google.api.resource_definition).type": "logging.googleapis.com/BillingAccountLocation", - "(google.api.resource_definition).pattern": "billingAccounts/{billing_account}/locations/{location}" - }, - "nested": { - "LogEntry": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/Log", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/logs/{log}", - "(google.api.resource).name_field": "log_name" - }, - "oneofs": { - "payload": { - "oneof": [ - "protoPayload", - "textPayload", - "jsonPayload" - ] - } - }, - "fields": { - "logName": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "resource": { - "type": "google.api.MonitoredResource", - "id": 8, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "protoPayload": { - "type": "google.protobuf.Any", - "id": 2 - }, - "textPayload": { - "type": "string", - "id": 3 - }, - "jsonPayload": { - "type": "google.protobuf.Struct", - "id": 6 - }, - "timestamp": { - "type": "google.protobuf.Timestamp", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "receiveTimestamp": { - "type": "google.protobuf.Timestamp", - "id": 24, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "severity": { - "type": "google.logging.type.LogSeverity", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "insertId": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "httpRequest": { - "type": "google.logging.type.HttpRequest", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "operation": { - "type": "LogEntryOperation", - "id": 15, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "trace": { - "type": "string", - "id": 22, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "spanId": { - "type": "string", - "id": 27, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "traceSampled": { - "type": "bool", - "id": 30, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "sourceLocation": { - "type": "LogEntrySourceLocation", - "id": 23, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "split": { - "type": "LogSplit", - "id": 35, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "LogEntryOperation": { - "fields": { - "id": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "producer": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "first": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "last": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "LogEntrySourceLocation": { - "fields": { - "file": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "line": { - "type": "int64", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "function": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "LogSplit": { - "fields": { - "uid": { - "type": "string", - "id": 1 - }, - "index": { - "type": "int32", - "id": 2 - }, - "totalSplits": { - "type": "int32", - "id": 3 - } - } - }, - "LoggingServiceV2": { - "options": { - "(google.api.default_host)": "logging.googleapis.com", - "(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" - }, - "methods": { - "DeleteLog": { - "requestType": "DeleteLogRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{log_name=projects/*/logs/*}", - "(google.api.http).additional_bindings.delete": "/v2/{log_name=billingAccounts/*/logs/*}", - "(google.api.method_signature)": "log_name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{log_name=projects/*/logs/*}", - "additional_bindings": [ - { - "delete": "/v2/{log_name=*/*/logs/*}" - }, - { - "delete": "/v2/{log_name=organizations/*/logs/*}" - }, - { - "delete": "/v2/{log_name=folders/*/logs/*}" - }, - { - "delete": "/v2/{log_name=billingAccounts/*/logs/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "log_name" - } - ] - }, - "WriteLogEntries": { - "requestType": "WriteLogEntriesRequest", - "responseType": "WriteLogEntriesResponse", - "options": { - "(google.api.http).post": "/v2/entries:write", - "(google.api.http).body": "*", - "(google.api.method_signature)": "log_name,resource,labels,entries" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/entries:write", - "body": "*" - } - }, - { - "(google.api.method_signature)": "log_name,resource,labels,entries" - } - ] - }, - "ListLogEntries": { - "requestType": "ListLogEntriesRequest", - "responseType": "ListLogEntriesResponse", - "options": { - "(google.api.http).post": "/v2/entries:list", - "(google.api.http).body": "*", - "(google.api.method_signature)": "resource_names,filter,order_by" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/entries:list", - "body": "*" - } - }, - { - "(google.api.method_signature)": "resource_names,filter,order_by" - } - ] - }, - "ListMonitoredResourceDescriptors": { - "requestType": "ListMonitoredResourceDescriptorsRequest", - "responseType": "ListMonitoredResourceDescriptorsResponse", - "options": { - "(google.api.http).get": "/v2/monitoredResourceDescriptors" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/monitoredResourceDescriptors" - } - } - ] - }, - "ListLogs": { - "requestType": "ListLogsRequest", - "responseType": "ListLogsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*}/logs", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*}/logs", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*}/logs" - }, - { - "get": "/v2/{parent=organizations/*}/logs" - }, - { - "get": "/v2/{parent=folders/*}/logs" - }, - { - "get": "/v2/{parent=billingAccounts/*}/logs" - }, - { - "get": "/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs" - }, - { - "get": "/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs" - }, - { - "get": "/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs" - }, - { - "get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "TailLogEntries": { - "requestType": "TailLogEntriesRequest", - "requestStream": true, - "responseType": "TailLogEntriesResponse", - "responseStream": true, - "options": { - "(google.api.http).post": "/v2/entries:tail", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/entries:tail", - "body": "*" - } - } - ] - } - } - }, - "DeleteLogRequest": { - "fields": { - "logName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/Log" - } - } - } - }, - "WriteLogEntriesRequest": { - "fields": { - "logName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "(google.api.resource_reference).type": "logging.googleapis.com/Log" - } - }, - "resource": { - "type": "google.api.MonitoredResource", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "entries": { - "rule": "repeated", - "type": "LogEntry", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "partialSuccess": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dryRun": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "WriteLogEntriesResponse": { - "fields": {} - }, - "WriteLogEntriesPartialErrors": { - "fields": { - "logEntryErrors": { - "keyType": "int32", - "type": "google.rpc.Status", - "id": 1 - } - } - }, - "ListLogEntriesRequest": { - "fields": { - "resourceNames": { - "rule": "repeated", - "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/Log" - } - }, - "filter": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "orderBy": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageToken": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListLogEntriesResponse": { - "fields": { - "entries": { - "rule": "repeated", - "type": "LogEntry", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "ListMonitoredResourceDescriptorsRequest": { - "fields": { - "pageSize": { - "type": "int32", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListMonitoredResourceDescriptorsResponse": { - "fields": { - "resourceDescriptors": { - "rule": "repeated", - "type": "google.api.MonitoredResourceDescriptor", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "ListLogsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/Log" - } - }, - "resourceNames": { - "rule": "repeated", - "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "(google.api.resource_reference).child_type": "logging.googleapis.com/Log" - } - }, - "pageSize": { - "type": "int32", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageToken": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListLogsResponse": { - "fields": { - "logNames": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "TailLogEntriesRequest": { - "fields": { - "resourceNames": { - "rule": "repeated", - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "filter": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "bufferWindow": { - "type": "google.protobuf.Duration", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "TailLogEntriesResponse": { - "fields": { - "entries": { - "rule": "repeated", - "type": "LogEntry", - "id": 1 - }, - "suppressionInfo": { - "rule": "repeated", - "type": "SuppressionInfo", - "id": 2 - } - }, - "nested": { - "SuppressionInfo": { - "fields": { - "reason": { - "type": "Reason", - "id": 1 - }, - "suppressedCount": { - "type": "int32", - "id": 2 - } - }, - "nested": { - "Reason": { - "values": { - "REASON_UNSPECIFIED": 0, - "RATE_LIMIT": 1, - "NOT_CONSUMED": 2 - } - } - } - } - } - }, - "ConfigServiceV2": { - "options": { - "(google.api.default_host)": "logging.googleapis.com", - "(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" - }, - "methods": { - "ListBuckets": { - "requestType": "ListBucketsRequest", - "responseType": "ListBucketsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*/locations/*}/buckets", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*/locations/*}/buckets", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*/locations/*}/buckets", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*/locations/*}/buckets" - }, - { - "get": "/v2/{parent=organizations/*/locations/*}/buckets" - }, - { - "get": "/v2/{parent=folders/*/locations/*}/buckets" - }, - { - "get": "/v2/{parent=billingAccounts/*/locations/*}/buckets" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetBucket": { - "requestType": "GetBucketRequest", - "responseType": "LogBucket", - "options": { - "(google.api.http).get": "/v2/{name=*/*/locations/*/buckets/*}", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*/locations/*/buckets/*}", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*/locations/*/buckets/*}" - }, - { - "get": "/v2/{name=organizations/*/locations/*/buckets/*}" - }, - { - "get": "/v2/{name=folders/*/locations/*/buckets/*}" - }, - { - "get": "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - ] - } - } - ] - }, - "CreateBucketAsync": { - "requestType": "CreateBucketRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{parent=*/*/locations/*}/buckets:createAsync", - "(google.api.http).body": "bucket", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync", - "(google.api.http).additional_bindings.body": "bucket", - "(google.longrunning.operation_info).response_type": "LogBucket", - "(google.longrunning.operation_info).metadata_type": "BucketMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*/locations/*}/buckets:createAsync", - "body": "bucket", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*/locations/*}/buckets:createAsync", - "body": "bucket" - }, - { - "post": "/v2/{parent=organizations/*/locations/*}/buckets:createAsync", - "body": "bucket" - }, - { - "post": "/v2/{parent=folders/*/locations/*}/buckets:createAsync", - "body": "bucket" - }, - { - "post": "/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync", - "body": "bucket" - } - ] - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "LogBucket", - "metadata_type": "BucketMetadata" - } - } - ] - }, - "UpdateBucketAsync": { - "requestType": "UpdateBucketRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{name=*/*/locations/*/buckets/*}:updateAsync", - "(google.api.http).body": "bucket", - "(google.api.http).additional_bindings.post": "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync", - "(google.api.http).additional_bindings.body": "bucket", - "(google.longrunning.operation_info).response_type": "LogBucket", - "(google.longrunning.operation_info).metadata_type": "BucketMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{name=*/*/locations/*/buckets/*}:updateAsync", - "body": "bucket", - "additional_bindings": [ - { - "post": "/v2/{name=projects/*/locations/*/buckets/*}:updateAsync", - "body": "bucket" - }, - { - "post": "/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync", - "body": "bucket" - }, - { - "post": "/v2/{name=folders/*/locations/*/buckets/*}:updateAsync", - "body": "bucket" - }, - { - "post": "/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync", - "body": "bucket" - } - ] - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "LogBucket", - "metadata_type": "BucketMetadata" - } - } - ] - }, - "CreateBucket": { - "requestType": "CreateBucketRequest", - "responseType": "LogBucket", - "options": { - "(google.api.http).post": "/v2/{parent=*/*/locations/*}/buckets", - "(google.api.http).body": "bucket", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*/locations/*}/buckets", - "(google.api.http).additional_bindings.body": "bucket" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*/locations/*}/buckets", - "body": "bucket", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*/locations/*}/buckets", - "body": "bucket" - }, - { - "post": "/v2/{parent=organizations/*/locations/*}/buckets", - "body": "bucket" - }, - { - "post": "/v2/{parent=folders/*/locations/*}/buckets", - "body": "bucket" - }, - { - "post": "/v2/{parent=billingAccounts/*/locations/*}/buckets", - "body": "bucket" - } - ] - } - } - ] - }, - "UpdateBucket": { - "requestType": "UpdateBucketRequest", - "responseType": "LogBucket", - "options": { - "(google.api.http).patch": "/v2/{name=*/*/locations/*/buckets/*}", - "(google.api.http).body": "bucket", - "(google.api.http).additional_bindings.patch": "/v2/{name=billingAccounts/*/locations/*/buckets/*}", - "(google.api.http).additional_bindings.body": "bucket" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{name=*/*/locations/*/buckets/*}", - "body": "bucket", - "additional_bindings": [ - { - "patch": "/v2/{name=projects/*/locations/*/buckets/*}", - "body": "bucket" - }, - { - "patch": "/v2/{name=organizations/*/locations/*/buckets/*}", - "body": "bucket" - }, - { - "patch": "/v2/{name=folders/*/locations/*/buckets/*}", - "body": "bucket" - }, - { - "patch": "/v2/{name=billingAccounts/*/locations/*/buckets/*}", - "body": "bucket" - } - ] - } - } - ] - }, - "DeleteBucket": { - "requestType": "DeleteBucketRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{name=*/*/locations/*/buckets/*}", - "(google.api.http).additional_bindings.delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{name=*/*/locations/*/buckets/*}", - "additional_bindings": [ - { - "delete": "/v2/{name=projects/*/locations/*/buckets/*}" - }, - { - "delete": "/v2/{name=organizations/*/locations/*/buckets/*}" - }, - { - "delete": "/v2/{name=folders/*/locations/*/buckets/*}" - }, - { - "delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - ] - } - } - ] - }, - "UndeleteBucket": { - "requestType": "UndeleteBucketRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v2/{name=*/*/locations/*/buckets/*}:undelete", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete", - "(google.api.http).additional_bindings.body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{name=*/*/locations/*/buckets/*}:undelete", - "body": "*", - "additional_bindings": [ - { - "post": "/v2/{name=projects/*/locations/*/buckets/*}:undelete", - "body": "*" - }, - { - "post": "/v2/{name=organizations/*/locations/*/buckets/*}:undelete", - "body": "*" - }, - { - "post": "/v2/{name=folders/*/locations/*/buckets/*}:undelete", - "body": "*" - }, - { - "post": "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete", - "body": "*" - } - ] - } - } - ] - }, - "ListViews": { - "requestType": "ListViewsRequest", - "responseType": "ListViewsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*/locations/*/buckets/*}/views", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*/locations/*/buckets/*}/views", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*/locations/*/buckets/*}/views" - }, - { - "get": "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - }, - { - "get": "/v2/{parent=folders/*/locations/*/buckets/*}/views" - }, - { - "get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetView": { - "requestType": "GetViewRequest", - "responseType": "LogView", - "options": { - "(google.api.http).get": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - }, - { - "get": "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - }, - { - "get": "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - }, - { - "get": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - ] - } - } - ] - }, - "CreateView": { - "requestType": "CreateViewRequest", - "responseType": "LogView", - "options": { - "(google.api.http).post": "/v2/{parent=*/*/locations/*/buckets/*}/views", - "(google.api.http).body": "view", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views", - "(google.api.http).additional_bindings.body": "view" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*/locations/*/buckets/*}/views", - "body": "view", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*/locations/*/buckets/*}/views", - "body": "view" - }, - { - "post": "/v2/{parent=organizations/*/locations/*/buckets/*}/views", - "body": "view" - }, - { - "post": "/v2/{parent=folders/*/locations/*/buckets/*}/views", - "body": "view" - }, - { - "post": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views", - "body": "view" - } - ] - } - } - ] - }, - "UpdateView": { - "requestType": "UpdateViewRequest", - "responseType": "LogView", - "options": { - "(google.api.http).patch": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "(google.api.http).body": "view", - "(google.api.http).additional_bindings.patch": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}", - "(google.api.http).additional_bindings.body": "view" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "body": "view", - "additional_bindings": [ - { - "patch": "/v2/{name=projects/*/locations/*/buckets/*/views/*}", - "body": "view" - }, - { - "patch": "/v2/{name=organizations/*/locations/*/buckets/*/views/*}", - "body": "view" - }, - { - "patch": "/v2/{name=folders/*/locations/*/buckets/*/views/*}", - "body": "view" - }, - { - "patch": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}", - "body": "view" - } - ] - } - } - ] - }, - "DeleteView": { - "requestType": "DeleteViewRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "(google.api.http).additional_bindings.delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{name=*/*/locations/*/buckets/*/views/*}", - "additional_bindings": [ - { - "delete": "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - }, - { - "delete": "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - }, - { - "delete": "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - }, - { - "delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - ] - } - } - ] - }, - "ListSinks": { - "requestType": "ListSinksRequest", - "responseType": "ListSinksResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*}/sinks", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*}/sinks", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*}/sinks", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*}/sinks" - }, - { - "get": "/v2/{parent=organizations/*}/sinks" - }, - { - "get": "/v2/{parent=folders/*}/sinks" - }, - { - "get": "/v2/{parent=billingAccounts/*}/sinks" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetSink": { - "requestType": "GetSinkRequest", - "responseType": "LogSink", - "options": { - "(google.api.http).get": "/v2/{sink_name=*/*/sinks/*}", - "(google.api.http).additional_bindings.get": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "(google.api.method_signature)": "sink_name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{sink_name=*/*/sinks/*}", - "additional_bindings": [ - { - "get": "/v2/{sink_name=projects/*/sinks/*}" - }, - { - "get": "/v2/{sink_name=organizations/*/sinks/*}" - }, - { - "get": "/v2/{sink_name=folders/*/sinks/*}" - }, - { - "get": "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "sink_name" - } - ] - }, - "CreateSink": { - "requestType": "CreateSinkRequest", - "responseType": "LogSink", - "options": { - "(google.api.http).post": "/v2/{parent=*/*}/sinks", - "(google.api.http).body": "sink", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*}/sinks", - "(google.api.http).additional_bindings.body": "sink", - "(google.api.method_signature)": "parent,sink" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*}/sinks", - "body": "sink", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*}/sinks", - "body": "sink" - }, - { - "post": "/v2/{parent=organizations/*}/sinks", - "body": "sink" - }, - { - "post": "/v2/{parent=folders/*}/sinks", - "body": "sink" - }, - { - "post": "/v2/{parent=billingAccounts/*}/sinks", - "body": "sink" - } - ] - } - }, - { - "(google.api.method_signature)": "parent,sink" - } - ] - }, - "UpdateSink": { - "requestType": "UpdateSinkRequest", - "responseType": "LogSink", - "options": { - "(google.api.http).put": "/v2/{sink_name=*/*/sinks/*}", - "(google.api.http).body": "sink", - "(google.api.http).additional_bindings.put": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "(google.api.http).additional_bindings.body": "sink", - "(google.api.http).additional_bindings.patch": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "(google.api.method_signature)": "sink_name,sink" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/v2/{sink_name=*/*/sinks/*}", - "body": "sink", - "additional_bindings": [ - { - "put": "/v2/{sink_name=projects/*/sinks/*}", - "body": "sink" - }, - { - "put": "/v2/{sink_name=organizations/*/sinks/*}", - "body": "sink" - }, - { - "put": "/v2/{sink_name=folders/*/sinks/*}", - "body": "sink" - }, - { - "put": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "body": "sink" - }, - { - "patch": "/v2/{sink_name=projects/*/sinks/*}", - "body": "sink" - }, - { - "patch": "/v2/{sink_name=organizations/*/sinks/*}", - "body": "sink" - }, - { - "patch": "/v2/{sink_name=folders/*/sinks/*}", - "body": "sink" - }, - { - "patch": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "body": "sink" - } - ] - } - }, - { - "(google.api.method_signature)": "sink_name,sink,update_mask" - }, - { - "(google.api.method_signature)": "sink_name,sink" - } - ] - }, - "DeleteSink": { - "requestType": "DeleteSinkRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{sink_name=*/*/sinks/*}", - "(google.api.http).additional_bindings.delete": "/v2/{sink_name=billingAccounts/*/sinks/*}", - "(google.api.method_signature)": "sink_name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{sink_name=*/*/sinks/*}", - "additional_bindings": [ - { - "delete": "/v2/{sink_name=projects/*/sinks/*}" - }, - { - "delete": "/v2/{sink_name=organizations/*/sinks/*}" - }, - { - "delete": "/v2/{sink_name=folders/*/sinks/*}" - }, - { - "delete": "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "sink_name" - } - ] - }, - "CreateLink": { - "requestType": "CreateLinkRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{parent=*/*/locations/*/buckets/*}/links", - "(google.api.http).body": "link", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links", - "(google.api.http).additional_bindings.body": "link", - "(google.api.method_signature)": "parent,link,link_id", - "(google.longrunning.operation_info).response_type": "Link", - "(google.longrunning.operation_info).metadata_type": "LinkMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*/locations/*/buckets/*}/links", - "body": "link", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*/locations/*/buckets/*}/links", - "body": "link" - }, - { - "post": "/v2/{parent=organizations/*/locations/*/buckets/*}/links", - "body": "link" - }, - { - "post": "/v2/{parent=folders/*/locations/*/buckets/*}/links", - "body": "link" - }, - { - "post": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links", - "body": "link" - } - ] - } - }, - { - "(google.api.method_signature)": "parent,link,link_id" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "Link", - "metadata_type": "LinkMetadata" - } - } - ] - }, - "DeleteLink": { - "requestType": "DeleteLinkRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).delete": "/v2/{name=*/*/locations/*/buckets/*/links/*}", - "(google.api.http).additional_bindings.delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}", - "(google.api.method_signature)": "name", - "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", - "(google.longrunning.operation_info).metadata_type": "LinkMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{name=*/*/locations/*/buckets/*/links/*}", - "additional_bindings": [ - { - "delete": "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - }, - { - "delete": "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - }, - { - "delete": "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - }, - { - "delete": "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "name" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.protobuf.Empty", - "metadata_type": "LinkMetadata" - } - } - ] - }, - "ListLinks": { - "requestType": "ListLinksRequest", - "responseType": "ListLinksResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*/locations/*/buckets/*}/links", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*/locations/*/buckets/*}/links", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*/locations/*/buckets/*}/links" - }, - { - "get": "/v2/{parent=organizations/*/locations/*/buckets/*}/links" - }, - { - "get": "/v2/{parent=folders/*/locations/*/buckets/*}/links" - }, - { - "get": "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetLink": { - "requestType": "GetLinkRequest", - "responseType": "Link", - "options": { - "(google.api.http).get": "/v2/{name=*/*/locations/*/buckets/*/links/*}", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*/locations/*/buckets/*/links/*}", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*/locations/*/buckets/*/links/*}" - }, - { - "get": "/v2/{name=organizations/*/locations/*/buckets/*/links/*}" - }, - { - "get": "/v2/{name=folders/*/locations/*/buckets/*/links/*}" - }, - { - "get": "/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListExclusions": { - "requestType": "ListExclusionsRequest", - "responseType": "ListExclusionsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=*/*}/exclusions", - "(google.api.http).additional_bindings.get": "/v2/{parent=billingAccounts/*}/exclusions", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=*/*}/exclusions", - "additional_bindings": [ - { - "get": "/v2/{parent=projects/*}/exclusions" - }, - { - "get": "/v2/{parent=organizations/*}/exclusions" - }, - { - "get": "/v2/{parent=folders/*}/exclusions" - }, - { - "get": "/v2/{parent=billingAccounts/*}/exclusions" - } - ] - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetExclusion": { - "requestType": "GetExclusionRequest", - "responseType": "LogExclusion", - "options": { - "(google.api.http).get": "/v2/{name=*/*/exclusions/*}", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*/exclusions/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*/exclusions/*}", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*/exclusions/*}" - }, - { - "get": "/v2/{name=organizations/*/exclusions/*}" - }, - { - "get": "/v2/{name=folders/*/exclusions/*}" - }, - { - "get": "/v2/{name=billingAccounts/*/exclusions/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateExclusion": { - "requestType": "CreateExclusionRequest", - "responseType": "LogExclusion", - "options": { - "(google.api.http).post": "/v2/{parent=*/*}/exclusions", - "(google.api.http).body": "exclusion", - "(google.api.http).additional_bindings.post": "/v2/{parent=billingAccounts/*}/exclusions", - "(google.api.http).additional_bindings.body": "exclusion", - "(google.api.method_signature)": "parent,exclusion" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=*/*}/exclusions", - "body": "exclusion", - "additional_bindings": [ - { - "post": "/v2/{parent=projects/*}/exclusions", - "body": "exclusion" - }, - { - "post": "/v2/{parent=organizations/*}/exclusions", - "body": "exclusion" - }, - { - "post": "/v2/{parent=folders/*}/exclusions", - "body": "exclusion" - }, - { - "post": "/v2/{parent=billingAccounts/*}/exclusions", - "body": "exclusion" - } - ] - } - }, - { - "(google.api.method_signature)": "parent,exclusion" - } - ] - }, - "UpdateExclusion": { - "requestType": "UpdateExclusionRequest", - "responseType": "LogExclusion", - "options": { - "(google.api.http).patch": "/v2/{name=*/*/exclusions/*}", - "(google.api.http).body": "exclusion", - "(google.api.http).additional_bindings.patch": "/v2/{name=billingAccounts/*/exclusions/*}", - "(google.api.http).additional_bindings.body": "exclusion", - "(google.api.method_signature)": "name,exclusion,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{name=*/*/exclusions/*}", - "body": "exclusion", - "additional_bindings": [ - { - "patch": "/v2/{name=projects/*/exclusions/*}", - "body": "exclusion" - }, - { - "patch": "/v2/{name=organizations/*/exclusions/*}", - "body": "exclusion" - }, - { - "patch": "/v2/{name=folders/*/exclusions/*}", - "body": "exclusion" - }, - { - "patch": "/v2/{name=billingAccounts/*/exclusions/*}", - "body": "exclusion" - } - ] - } - }, - { - "(google.api.method_signature)": "name,exclusion,update_mask" - } - ] - }, - "DeleteExclusion": { - "requestType": "DeleteExclusionRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{name=*/*/exclusions/*}", - "(google.api.http).additional_bindings.delete": "/v2/{name=billingAccounts/*/exclusions/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{name=*/*/exclusions/*}", - "additional_bindings": [ - { - "delete": "/v2/{name=projects/*/exclusions/*}" - }, - { - "delete": "/v2/{name=organizations/*/exclusions/*}" - }, - { - "delete": "/v2/{name=folders/*/exclusions/*}" - }, - { - "delete": "/v2/{name=billingAccounts/*/exclusions/*}" - } - ] - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "GetCmekSettings": { - "requestType": "GetCmekSettingsRequest", - "responseType": "CmekSettings", - "options": { - "(google.api.http).get": "/v2/{name=*/*}/cmekSettings", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*}/cmekSettings" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*}/cmekSettings", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*}/cmekSettings" - }, - { - "get": "/v2/{name=organizations/*}/cmekSettings" - }, - { - "get": "/v2/{name=folders/*}/cmekSettings" - }, - { - "get": "/v2/{name=billingAccounts/*}/cmekSettings" - } - ] - } - } - ] - }, - "UpdateCmekSettings": { - "requestType": "UpdateCmekSettingsRequest", - "responseType": "CmekSettings", - "options": { - "(google.api.http).patch": "/v2/{name=*/*}/cmekSettings", - "(google.api.http).body": "cmek_settings", - "(google.api.http).additional_bindings.patch": "/v2/{name=organizations/*}/cmekSettings", - "(google.api.http).additional_bindings.body": "cmek_settings" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{name=*/*}/cmekSettings", - "body": "cmek_settings", - "additional_bindings": { - "patch": "/v2/{name=organizations/*}/cmekSettings", - "body": "cmek_settings" - } - } - } - ] - }, - "GetSettings": { - "requestType": "GetSettingsRequest", - "responseType": "Settings", - "options": { - "(google.api.http).get": "/v2/{name=*/*}/settings", - "(google.api.http).additional_bindings.get": "/v2/{name=billingAccounts/*}/settings", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{name=*/*}/settings", - "additional_bindings": [ - { - "get": "/v2/{name=projects/*}/settings" - }, - { - "get": "/v2/{name=organizations/*}/settings" - }, - { - "get": "/v2/{name=folders/*}/settings" - }, - { - "get": "/v2/{name=billingAccounts/*}/settings" - } - ] - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateSettings": { - "requestType": "UpdateSettingsRequest", - "responseType": "Settings", - "options": { - "(google.api.http).patch": "/v2/{name=*/*}/settings", - "(google.api.http).body": "settings", - "(google.api.http).additional_bindings.patch": "/v2/{name=folders/*}/settings", - "(google.api.http).additional_bindings.body": "settings", - "(google.api.method_signature)": "settings,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{name=*/*}/settings", - "body": "settings", - "additional_bindings": [ - { - "patch": "/v2/{name=organizations/*}/settings", - "body": "settings" - }, - { - "patch": "/v2/{name=folders/*}/settings", - "body": "settings" - } - ] - } - }, - { - "(google.api.method_signature)": "settings,update_mask" - } - ] - }, - "CopyLogEntries": { - "requestType": "CopyLogEntriesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/entries:copy", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "CopyLogEntriesResponse", - "(google.longrunning.operation_info).metadata_type": "CopyLogEntriesMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/entries:copy", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "CopyLogEntriesResponse", - "metadata_type": "CopyLogEntriesMetadata" - } - } - ] - } - } - }, - "IndexConfig": { - "fields": { - "fieldPath": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "type": { - "type": "IndexType", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "LogBucket": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/LogBucket", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "description": { - "type": "string", - "id": 3 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "retentionDays": { - "type": "int32", - "id": 11 - }, - "locked": { - "type": "bool", - "id": 9 - }, - "lifecycleState": { - "type": "LifecycleState", - "id": 12, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "analyticsEnabled": { - "type": "bool", - "id": 14 - }, - "restrictedFields": { - "rule": "repeated", - "type": "string", - "id": 15 - }, - "indexConfigs": { - "rule": "repeated", - "type": "IndexConfig", - "id": 17 - }, - "cmekSettings": { - "type": "CmekSettings", - "id": 19 - } - } - }, - "LogView": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/LogView", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "description": { - "type": "string", - "id": 3 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "filter": { - "type": "string", - "id": 7 - } - } - }, - "LogSink": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/LogSink", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/sinks/{sink}" - }, - "oneofs": { - "options": { - "oneof": [ - "bigqueryOptions" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "destination": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "*" - } - }, - "filter": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "description": { - "type": "string", - "id": 18, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "disabled": { - "type": "bool", - "id": 19, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "exclusions": { - "rule": "repeated", - "type": "LogExclusion", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "outputVersionFormat": { - "type": "VersionFormat", - "id": 6, - "options": { - "deprecated": true - } - }, - "writerIdentity": { - "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "includeChildren": { - "type": "bool", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "bigqueryOptions": { - "type": "BigQueryOptions", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 13, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 14, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "VersionFormat": { - "values": { - "VERSION_FORMAT_UNSPECIFIED": 0, - "V2": 1, - "V1": 2 - } - } - } - }, - "BigQueryDataset": { - "fields": { - "datasetId": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "Link": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/Link", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "description": { - "type": "string", - "id": 2 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "lifecycleState": { - "type": "LifecycleState", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "bigqueryDataset": { - "type": "BigQueryDataset", - "id": 5 - } - } - }, - "BigQueryOptions": { - "fields": { - "usePartitionedTables": { - "type": "bool", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "usesTimestampColumnPartitioning": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "ListBucketsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogBucket" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListBucketsResponse": { - "fields": { - "buckets": { - "rule": "repeated", - "type": "LogBucket", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "CreateBucketRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogBucket" - } - }, - "bucketId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "bucket": { - "type": "LogBucket", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "UpdateBucketRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogBucket" - } - }, - "bucket": { - "type": "LogBucket", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "GetBucketRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogBucket" - } - } - } - }, - "DeleteBucketRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogBucket" - } - } - } - }, - "UndeleteBucketRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogBucket" - } - } - } - }, - "ListViewsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListViewsResponse": { - "fields": { - "views": { - "rule": "repeated", - "type": "LogView", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "CreateViewRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "viewId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "view": { - "type": "LogView", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "UpdateViewRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "view": { - "type": "LogView", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "GetViewRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogView" - } - } - } - }, - "DeleteViewRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogView" - } - } - } - }, - "ListSinksRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogSink" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListSinksResponse": { - "fields": { - "sinks": { - "rule": "repeated", - "type": "LogSink", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetSinkRequest": { - "fields": { - "sinkName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogSink" - } - } - } - }, - "CreateSinkRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogSink" - } - }, - "sink": { - "type": "LogSink", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "uniqueWriterIdentity": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "UpdateSinkRequest": { - "fields": { - "sinkName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogSink" - } - }, - "sink": { - "type": "LogSink", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "uniqueWriterIdentity": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "DeleteSinkRequest": { - "fields": { - "sinkName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogSink" - } - } - } - }, - "CreateLinkRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/Link" - } - }, - "link": { - "type": "Link", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "linkId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "DeleteLinkRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/Link" - } - } - } - }, - "ListLinksRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/Link" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListLinksResponse": { - "fields": { - "links": { - "rule": "repeated", - "type": "Link", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetLinkRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/Link" - } - } - } - }, - "LogExclusion": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/LogExclusion", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/exclusions/{exclusion}" - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "description": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "filter": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "disabled": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 6, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "ListExclusionsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogExclusion" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListExclusionsResponse": { - "fields": { - "exclusions": { - "rule": "repeated", - "type": "LogExclusion", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetExclusionRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogExclusion" - } - } - } - }, - "CreateExclusionRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogExclusion" - } - }, - "exclusion": { - "type": "LogExclusion", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "UpdateExclusionRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogExclusion" - } - }, - "exclusion": { - "type": "LogExclusion", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "DeleteExclusionRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogExclusion" - } - } - } - }, - "GetCmekSettingsRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/CmekSettings" - } - } - } - }, - "UpdateCmekSettingsRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "cmekSettings": { - "type": "CmekSettings", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "CmekSettings": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/CmekSettings", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/cmekSettings" - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKeyName": { - "type": "string", - "id": 2 - }, - "kmsKeyVersionName": { - "type": "string", - "id": 4 - }, - "serviceAccountId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "GetSettingsRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/Settings" - } - } - } - }, - "UpdateSettingsRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "settings": { - "type": "Settings", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "Settings": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/Settings", - "(google.api.resource).pattern": "billingAccounts/{billing_account}/settings" - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKeyName": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "kmsServiceAccountId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "storageLocation": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "disableDefaultSink": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "CopyLogEntriesRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "filter": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "destination": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "CopyLogEntriesMetadata": { - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "state": { - "type": "OperationState", - "id": 3 - }, - "cancellationRequested": { - "type": "bool", - "id": 4 - }, - "request": { - "type": "CopyLogEntriesRequest", - "id": 5 - }, - "progress": { - "type": "int32", - "id": 6 - }, - "writerIdentity": { - "type": "string", - "id": 7 - } - } - }, - "CopyLogEntriesResponse": { - "fields": { - "logEntriesCopiedCount": { - "type": "int64", - "id": 1 - } - } - }, - "BucketMetadata": { - "oneofs": { - "request": { - "oneof": [ - "createBucketRequest", - "updateBucketRequest" - ] - } - }, - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "state": { - "type": "OperationState", - "id": 3 - }, - "createBucketRequest": { - "type": "CreateBucketRequest", - "id": 4 - }, - "updateBucketRequest": { - "type": "UpdateBucketRequest", - "id": 5 - } - } - }, - "LinkMetadata": { - "oneofs": { - "request": { - "oneof": [ - "createLinkRequest", - "deleteLinkRequest" - ] - } - }, - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "state": { - "type": "OperationState", - "id": 3 - }, - "createLinkRequest": { - "type": "CreateLinkRequest", - "id": 4 - }, - "deleteLinkRequest": { - "type": "DeleteLinkRequest", - "id": 5 - } - } - }, - "OperationState": { - "values": { - "OPERATION_STATE_UNSPECIFIED": 0, - "OPERATION_STATE_SCHEDULED": 1, - "OPERATION_STATE_WAITING_FOR_PERMISSIONS": 2, - "OPERATION_STATE_RUNNING": 3, - "OPERATION_STATE_SUCCEEDED": 4, - "OPERATION_STATE_FAILED": 5, - "OPERATION_STATE_CANCELLED": 6 - } - }, - "LifecycleState": { - "values": { - "LIFECYCLE_STATE_UNSPECIFIED": 0, - "ACTIVE": 1, - "DELETE_REQUESTED": 2, - "UPDATING": 3, - "CREATING": 4, - "FAILED": 5 - } - }, - "IndexType": { - "values": { - "INDEX_TYPE_UNSPECIFIED": 0, - "INDEX_TYPE_STRING": 1, - "INDEX_TYPE_INTEGER": 2 - } - }, - "LocationMetadata": { - "fields": { - "logAnalyticsEnabled": { - "type": "bool", - "id": 1 - } - } - }, - "MetricsServiceV2": { - "options": { - "(google.api.default_host)": "logging.googleapis.com", - "(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" - }, - "methods": { - "ListLogMetrics": { - "requestType": "ListLogMetricsRequest", - "responseType": "ListLogMetricsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*}/metrics", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*}/metrics" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetLogMetric": { - "requestType": "GetLogMetricRequest", - "responseType": "LogMetric", - "options": { - "(google.api.http).get": "/v2/{metric_name=projects/*/metrics/*}", - "(google.api.method_signature)": "metric_name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{metric_name=projects/*/metrics/*}" - } - }, - { - "(google.api.method_signature)": "metric_name" - } - ] - }, - "CreateLogMetric": { - "requestType": "CreateLogMetricRequest", - "responseType": "LogMetric", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*}/metrics", - "(google.api.http).body": "metric", - "(google.api.method_signature)": "parent,metric" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*}/metrics", - "body": "metric" - } - }, - { - "(google.api.method_signature)": "parent,metric" - } - ] - }, - "UpdateLogMetric": { - "requestType": "UpdateLogMetricRequest", - "responseType": "LogMetric", - "options": { - "(google.api.http).put": "/v2/{metric_name=projects/*/metrics/*}", - "(google.api.http).body": "metric", - "(google.api.method_signature)": "metric_name,metric" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/v2/{metric_name=projects/*/metrics/*}", - "body": "metric" - } - }, - { - "(google.api.method_signature)": "metric_name,metric" - } - ] - }, - "DeleteLogMetric": { - "requestType": "DeleteLogMetricRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v2/{metric_name=projects/*/metrics/*}", - "(google.api.method_signature)": "metric_name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v2/{metric_name=projects/*/metrics/*}" - } - }, - { - "(google.api.method_signature)": "metric_name" - } - ] - } - } - }, - "LogMetric": { - "options": { - "(google.api.resource).type": "logging.googleapis.com/LogMetric", - "(google.api.resource).pattern": "projects/{project}/metrics/{metric}" - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "description": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "filter": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "bucketName": { - "type": "string", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "disabled": { - "type": "bool", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "metricDescriptor": { - "type": "google.api.MetricDescriptor", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "valueExtractor": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "labelExtractors": { - "keyType": "string", - "type": "string", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "bucketOptions": { - "type": "google.api.Distribution.BucketOptions", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 10, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "version": { - "type": "ApiVersion", - "id": 4, - "options": { - "deprecated": true - } - } - }, - "nested": { - "ApiVersion": { - "values": { - "V2": 0, - "V1": 1 - } - } - } - }, - "ListLogMetricsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" - } - }, - "pageToken": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pageSize": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListLogMetricsResponse": { - "fields": { - "metrics": { - "rule": "repeated", - "type": "LogMetric", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetLogMetricRequest": { - "fields": { - "metricName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogMetric" - } - } - } - }, - "CreateLogMetricRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "logging.googleapis.com/LogMetric" - } - }, - "metric": { - "type": "LogMetric", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "UpdateLogMetricRequest": { - "fields": { - "metricName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogMetric" - } - }, - "metric": { - "type": "LogMetric", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "DeleteLogMetricRequest": { - "fields": { - "metricName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "logging.googleapis.com/LogMetric" - } - } - } - } - } - } - } - }, - "api": { - "options": { - "go_package": "google.golang.org/genproto/googleapis/api/metric;metric", - "java_multiple_files": true, - "java_outer_classname": "MetricProto", - "java_package": "com.google.api", - "objc_class_prefix": "GAPI" - }, - "nested": { - "fieldBehavior": { - "rule": "repeated", - "type": "google.api.FieldBehavior", - "id": 1052, - "extend": "google.protobuf.FieldOptions", - "options": { - "packed": false - } - }, - "FieldBehavior": { - "values": { - "FIELD_BEHAVIOR_UNSPECIFIED": 0, - "OPTIONAL": 1, - "REQUIRED": 2, - "OUTPUT_ONLY": 3, - "INPUT_ONLY": 4, - "IMMUTABLE": 5, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7, - "IDENTIFIER": 8 - } - }, - "MonitoredResourceDescriptor": { - "fields": { - "name": { - "type": "string", - "id": 5 - }, - "type": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "labels": { - "rule": "repeated", - "type": "LabelDescriptor", - "id": 4 - }, - "launchStage": { - "type": "LaunchStage", - "id": 7 - } - } - }, - "MonitoredResource": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 2 - } - } - }, - "MonitoredResourceMetadata": { - "fields": { - "systemLabels": { - "type": "google.protobuf.Struct", - "id": 1 - }, - "userLabels": { - "keyType": "string", - "type": "string", - "id": 2 - } - } - }, - "LabelDescriptor": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "valueType": { - "type": "ValueType", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - }, - "nested": { - "ValueType": { - "values": { - "STRING": 0, - "BOOL": 1, - "INT64": 2 - } - } - } - }, - "LaunchStage": { - "values": { - "LAUNCH_STAGE_UNSPECIFIED": 0, - "UNIMPLEMENTED": 6, - "PRELAUNCH": 7, - "EARLY_ACCESS": 1, - "ALPHA": 2, - "BETA": 3, - "GA": 4, - "DEPRECATED": 5 - } - }, - "resourceReference": { - "type": "google.api.ResourceReference", - "id": 1055, - "extend": "google.protobuf.FieldOptions" - }, - "resourceDefinition": { - "rule": "repeated", - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.FileOptions" - }, - "resource": { - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.MessageOptions" - }, - "ResourceDescriptor": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "pattern": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "nameField": { - "type": "string", - "id": 3 - }, - "history": { - "type": "History", - "id": 4 - }, - "plural": { - "type": "string", - "id": 5 - }, - "singular": { - "type": "string", - "id": 6 - }, - "style": { - "rule": "repeated", - "type": "Style", - "id": 10 - } - }, - "nested": { - "History": { - "values": { - "HISTORY_UNSPECIFIED": 0, - "ORIGINALLY_SINGLE_PATTERN": 1, - "FUTURE_MULTI_PATTERN": 2 - } - }, - "Style": { - "values": { - "STYLE_UNSPECIFIED": 0, - "DECLARATIVE_FRIENDLY": 1 - } - } - } - }, - "ResourceReference": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "childType": { - "type": "string", - "id": 2 - } - } - }, - "http": { - "type": "HttpRule", - "id": 72295728, - "extend": "google.protobuf.MethodOptions" - }, - "Http": { - "fields": { - "rules": { - "rule": "repeated", - "type": "HttpRule", - "id": 1 - }, - "fullyDecodeReservedExpansion": { - "type": "bool", - "id": 2 - } - } - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "body": { - "type": "string", - "id": 7 - }, - "responseBody": { - "type": "string", - "id": 12 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - }, - "CustomHttpPattern": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "path": { - "type": "string", - "id": 2 - } - } - }, - "methodSignature": { - "rule": "repeated", - "type": "string", - "id": 1051, - "extend": "google.protobuf.MethodOptions" - }, - "defaultHost": { - "type": "string", - "id": 1049, - "extend": "google.protobuf.ServiceOptions" - }, - "oauthScopes": { - "type": "string", - "id": 1050, - "extend": "google.protobuf.ServiceOptions" - }, - "apiVersion": { - "type": "string", - "id": 525000001, - "extend": "google.protobuf.ServiceOptions" - }, - "CommonLanguageSettings": { - "fields": { - "referenceDocsUri": { - "type": "string", - "id": 1, - "options": { - "deprecated": true - } - }, - "destinations": { - "rule": "repeated", - "type": "ClientLibraryDestination", - "id": 2 - }, - "selectiveGapicGeneration": { - "type": "SelectiveGapicGeneration", - "id": 3 - } - } - }, - "ClientLibrarySettings": { - "fields": { - "version": { - "type": "string", - "id": 1 - }, - "launchStage": { - "type": "LaunchStage", - "id": 2 - }, - "restNumericEnums": { - "type": "bool", - "id": 3 - }, - "javaSettings": { - "type": "JavaSettings", - "id": 21 - }, - "cppSettings": { - "type": "CppSettings", - "id": 22 - }, - "phpSettings": { - "type": "PhpSettings", - "id": 23 - }, - "pythonSettings": { - "type": "PythonSettings", - "id": 24 - }, - "nodeSettings": { - "type": "NodeSettings", - "id": 25 - }, - "dotnetSettings": { - "type": "DotnetSettings", - "id": 26 - }, - "rubySettings": { - "type": "RubySettings", - "id": 27 - }, - "goSettings": { - "type": "GoSettings", - "id": 28 - } - } - }, - "Publishing": { - "fields": { - "methodSettings": { - "rule": "repeated", - "type": "MethodSettings", - "id": 2 - }, - "newIssueUri": { - "type": "string", - "id": 101 - }, - "documentationUri": { - "type": "string", - "id": 102 - }, - "apiShortName": { - "type": "string", - "id": 103 - }, - "githubLabel": { - "type": "string", - "id": 104 - }, - "codeownerGithubTeams": { - "rule": "repeated", - "type": "string", - "id": 105 - }, - "docTagPrefix": { - "type": "string", - "id": 106 - }, - "organization": { - "type": "ClientLibraryOrganization", - "id": 107 - }, - "librarySettings": { - "rule": "repeated", - "type": "ClientLibrarySettings", - "id": 109 - }, - "protoReferenceDocumentationUri": { - "type": "string", - "id": 110 - }, - "restReferenceDocumentationUri": { - "type": "string", - "id": 111 - } - } - }, - "JavaSettings": { - "fields": { - "libraryPackage": { - "type": "string", - "id": 1 - }, - "serviceClassNames": { - "keyType": "string", - "type": "string", - "id": 2 - }, - "common": { - "type": "CommonLanguageSettings", - "id": 3 - } - } - }, - "CppSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "PhpSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "PythonSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "experimentalFeatures": { - "type": "ExperimentalFeatures", - "id": 2 - } - }, - "nested": { - "ExperimentalFeatures": { - "fields": { - "restAsyncIoEnabled": { - "type": "bool", - "id": 1 - }, - "protobufPythonicTypesEnabled": { - "type": "bool", - "id": 2 - }, - "unversionedPackageDisabled": { - "type": "bool", - "id": 3 - } - } - } - } - }, - "NodeSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "DotnetSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "renamedServices": { - "keyType": "string", - "type": "string", - "id": 2 - }, - "renamedResources": { - "keyType": "string", - "type": "string", - "id": 3 - }, - "ignoredResources": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "forcedNamespaceAliases": { - "rule": "repeated", - "type": "string", - "id": 5 - }, - "handwrittenSignatures": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - }, - "RubySettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "GoSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "renamedServices": { - "keyType": "string", - "type": "string", - "id": 2 - } - } - }, - "MethodSettings": { - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "longRunning": { - "type": "LongRunning", - "id": 2 - }, - "autoPopulatedFields": { - "rule": "repeated", - "type": "string", - "id": 3 - } - }, - "nested": { - "LongRunning": { - "fields": { - "initialPollDelay": { - "type": "google.protobuf.Duration", - "id": 1 - }, - "pollDelayMultiplier": { - "type": "float", - "id": 2 - }, - "maxPollDelay": { - "type": "google.protobuf.Duration", - "id": 3 - }, - "totalPollTimeout": { - "type": "google.protobuf.Duration", - "id": 4 - } - } - } - } - }, - "ClientLibraryOrganization": { - "values": { - "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0, - "CLOUD": 1, - "ADS": 2, - "PHOTOS": 3, - "STREET_VIEW": 4, - "SHOPPING": 5, - "GEO": 6, - "GENERATIVE_AI": 7 - } - }, - "ClientLibraryDestination": { - "values": { - "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0, - "GITHUB": 10, - "PACKAGE_MANAGER": 20 - } - }, - "SelectiveGapicGeneration": { - "fields": { - "methods": { - "rule": "repeated", - "type": "string", - "id": 1 - }, - "generateOmittedAsInternal": { - "type": "bool", - "id": 2 - } - } - }, - "Distribution": { - "fields": { - "count": { - "type": "int64", - "id": 1 - }, - "mean": { - "type": "double", - "id": 2 - }, - "sumOfSquaredDeviation": { - "type": "double", - "id": 3 - }, - "range": { - "type": "Range", - "id": 4 - }, - "bucketOptions": { - "type": "BucketOptions", - "id": 6 - }, - "bucketCounts": { - "rule": "repeated", - "type": "int64", - "id": 7 - }, - "exemplars": { - "rule": "repeated", - "type": "Exemplar", - "id": 10 - } - }, - "nested": { - "Range": { - "fields": { - "min": { - "type": "double", - "id": 1 - }, - "max": { - "type": "double", - "id": 2 - } - } - }, - "BucketOptions": { - "oneofs": { - "options": { - "oneof": [ - "linearBuckets", - "exponentialBuckets", - "explicitBuckets" - ] - } - }, - "fields": { - "linearBuckets": { - "type": "Linear", - "id": 1 - }, - "exponentialBuckets": { - "type": "Exponential", - "id": 2 - }, - "explicitBuckets": { - "type": "Explicit", - "id": 3 - } - }, - "nested": { - "Linear": { - "fields": { - "numFiniteBuckets": { - "type": "int32", - "id": 1 - }, - "width": { - "type": "double", - "id": 2 - }, - "offset": { - "type": "double", - "id": 3 - } - } - }, - "Exponential": { - "fields": { - "numFiniteBuckets": { - "type": "int32", - "id": 1 - }, - "growthFactor": { - "type": "double", - "id": 2 - }, - "scale": { - "type": "double", - "id": 3 - } - } - }, - "Explicit": { - "fields": { - "bounds": { - "rule": "repeated", - "type": "double", - "id": 1 - } - } - } - } - }, - "Exemplar": { - "fields": { - "value": { - "type": "double", - "id": 1 - }, - "timestamp": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "attachments": { - "rule": "repeated", - "type": "google.protobuf.Any", - "id": 3 - } - } - } - } - }, - "MetricDescriptor": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "type": { - "type": "string", - "id": 8 - }, - "labels": { - "rule": "repeated", - "type": "LabelDescriptor", - "id": 2 - }, - "metricKind": { - "type": "MetricKind", - "id": 3 - }, - "valueType": { - "type": "ValueType", - "id": 4 - }, - "unit": { - "type": "string", - "id": 5 - }, - "description": { - "type": "string", - "id": 6 - }, - "displayName": { - "type": "string", - "id": 7 - }, - "metadata": { - "type": "MetricDescriptorMetadata", - "id": 10 - }, - "launchStage": { - "type": "LaunchStage", - "id": 12 - }, - "monitoredResourceTypes": { - "rule": "repeated", - "type": "string", - "id": 13 - } - }, - "nested": { - "MetricKind": { - "values": { - "METRIC_KIND_UNSPECIFIED": 0, - "GAUGE": 1, - "DELTA": 2, - "CUMULATIVE": 3 - } - }, - "ValueType": { - "values": { - "VALUE_TYPE_UNSPECIFIED": 0, - "BOOL": 1, - "INT64": 2, - "DOUBLE": 3, - "STRING": 4, - "DISTRIBUTION": 5, - "MONEY": 6 - } - }, - "MetricDescriptorMetadata": { - "fields": { - "launchStage": { - "type": "LaunchStage", - "id": 1, - "options": { - "deprecated": true - } - }, - "samplePeriod": { - "type": "google.protobuf.Duration", - "id": 2 - }, - "ingestDelay": { - "type": "google.protobuf.Duration", - "id": 3 - }, - "timeSeriesResourceHierarchyLevel": { - "rule": "repeated", - "type": "TimeSeriesResourceHierarchyLevel", - "id": 4 - } - }, - "nested": { - "TimeSeriesResourceHierarchyLevel": { - "values": { - "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED": 0, - "PROJECT": 1, - "ORGANIZATION": 2, - "FOLDER": 3 - } - } - } - } - } - }, - "Metric": { - "fields": { - "type": { - "type": "string", - "id": 3 - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 2 - } - } - } - } - }, - "rpc": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", - "java_multiple_files": true, - "java_outer_classname": "StatusProto", - "java_package": "com.google.rpc", - "objc_class_prefix": "RPC" - }, - "nested": { - "Status": { - "fields": { - "code": { - "type": "int32", - "id": 1 - }, - "message": { - "type": "string", - "id": 2 - }, - "details": { - "rule": "repeated", - "type": "google.protobuf.Any", - "id": 3 - } - } - } - } - }, - "longrunning": { - "options": { - "cc_enable_arenas": true, - "csharp_namespace": "Google.LongRunning", - "go_package": "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb", - "java_multiple_files": true, - "java_outer_classname": "OperationsProto", - "java_package": "com.google.longrunning", - "objc_class_prefix": "GLRUN", - "php_namespace": "Google\\LongRunning" - }, - "nested": { - "operationInfo": { - "type": "google.longrunning.OperationInfo", - "id": 1049, - "extend": "google.protobuf.MethodOptions" - }, - "Operations": { - "options": { - "(google.api.default_host)": "longrunning.googleapis.com" - }, - "methods": { - "ListOperations": { - "requestType": "ListOperationsRequest", - "responseType": "ListOperationsResponse", - "options": { - "(google.api.http).get": "/v1/{name=operations}", - "(google.api.method_signature)": "name,filter" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=operations}" - } - }, - { - "(google.api.method_signature)": "name,filter" - } - ] - }, - "GetOperation": { - "requestType": "GetOperationRequest", - "responseType": "Operation", - "options": { - "(google.api.http).get": "/v1/{name=operations/**}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=operations/**}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "DeleteOperation": { - "requestType": "DeleteOperationRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=operations/**}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=operations/**}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CancelOperation": { - "requestType": "CancelOperationRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1/{name=operations/**}:cancel", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=operations/**}:cancel", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "WaitOperation": { - "requestType": "WaitOperationRequest", - "responseType": "Operation" - } - } - }, - "Operation": { - "oneofs": { - "result": { - "oneof": [ - "error", - "response" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "metadata": { - "type": "google.protobuf.Any", - "id": 2 - }, - "done": { - "type": "bool", - "id": 3 - }, - "error": { - "type": "google.rpc.Status", - "id": 4 - }, - "response": { - "type": "google.protobuf.Any", - "id": 5 - } - } - }, - "GetOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "ListOperationsRequest": { - "fields": { - "name": { - "type": "string", - "id": 4 - }, - "filter": { - "type": "string", - "id": 1 - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListOperationsResponse": { - "fields": { - "operations": { - "rule": "repeated", - "type": "Operation", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "CancelOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "DeleteOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "WaitOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "timeout": { - "type": "google.protobuf.Duration", - "id": 2 - } - } - }, - "OperationInfo": { - "fields": { - "responseType": { - "type": "string", - "id": 1 - }, - "metadataType": { - "type": "string", - "id": 2 - } - } - } - } - } - } - } - } -} \ No newline at end of file +{} \ No newline at end of file diff --git a/handwritten/logging/src/index.ts b/handwritten/logging/src/index.ts index 8894861a11d0..43b1487fbcaa 100644 --- a/handwritten/logging/src/index.ts +++ b/handwritten/logging/src/index.ts @@ -38,7 +38,7 @@ export {detectServiceContext}; const version = require('../../package.json').version; // eslint-disable-next-line @typescript-eslint/no-var-requires -const v2 = require('./v2'); +const v2 = require('@google-cloud/logging-api'); import {Entry, LogEntry} from './entry'; import { diff --git a/handwritten/logging/src/v2/config_service_v2_client.ts b/handwritten/logging/src/v2/config_service_v2_client.ts deleted file mode 100644 index 11d0e92a5fd3..000000000000 --- a/handwritten/logging/src/v2/config_service_v2_client.ts +++ /dev/null @@ -1,6552 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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}; - private _universeDomain: string; - private _servicePath: string; - 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; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._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 !== this._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 = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && '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. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - createBucketAsync( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - createBucketAsync( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - 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< - LROperation< - protos.google.logging.v2.LogBucket, - protos.google.logging.v2.BucketMetadata - > - > { - 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< - protos.google.logging.v2.LogBucket, - protos.google.logging.v2.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. - * - * @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.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - updateBucketAsync( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - updateBucketAsync( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >, - 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< - LROperation< - protos.google.logging.v2.LogBucket, - protos.google.logging.v2.BucketMetadata - > - > { - 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< - protos.google.logging.v2.LogBucket, - protos.google.logging.v2.BucketMetadata - >; - } - /** - * 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.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - createLink( - request: protos.google.logging.v2.ICreateLinkRequest, - callback: Callback< - LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - createLink( - request?: protos.google.logging.v2.ICreateLinkRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >, - 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< - LROperation< - protos.google.logging.v2.Link, - protos.google.logging.v2.LinkMetadata - > - > { - 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< - protos.google.logging.v2.Link, - protos.google.logging.v2.LinkMetadata - >; - } - /** - * 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.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - deleteLink( - request: protos.google.logging.v2.IDeleteLinkRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - deleteLink( - request?: protos.google.logging.v2.IDeleteLinkRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >, - 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< - LROperation< - protos.google.protobuf.Empty, - protos.google.logging.v2.LinkMetadata - > - > { - 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< - protos.google.protobuf.Empty, - protos.google.logging.v2.LinkMetadata - >; - } - /** - * 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.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - callback: Callback< - LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): void; - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >, - 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< - LROperation< - protos.google.logging.v2.CopyLogEntriesResponse, - protos.google.logging.v2.CopyLogEntriesMetadata - > - > { - 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< - protos.google.logging.v2.CopyLogEntriesResponse, - protos.google.logging.v2.CopyLogEntriesMetadata - >; - } - /** - * 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/handwritten/logging/src/v2/config_service_v2_client_config.json b/handwritten/logging/src/v2/config_service_v2_client_config.json deleted file mode 100644 index 0e890aa4f2df..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/config_service_v2_proto_list.json b/handwritten/logging/src/v2/config_service_v2_proto_list.json deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/gapic_metadata.json b/handwritten/logging/src/v2/gapic_metadata.json deleted file mode 100644 index 047d5888e62a..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/index.ts b/handwritten/logging/src/v2/index.ts deleted file mode 100644 index 2cc712044a0a..000000000000 --- a/handwritten/logging/src/v2/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/handwritten/logging/src/v2/logging_service_v2_client.ts b/handwritten/logging/src/v2/logging_service_v2_client.ts deleted file mode 100644 index 5995243420cb..000000000000 --- a/handwritten/logging/src/v2/logging_service_v2_client.ts +++ /dev/null @@ -1,3218 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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}; - private _universeDomain: string; - private _servicePath: string; - 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; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._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 !== this._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 = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && '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, - !!opts.gaxServerStreamingRetries, - ), - }; - - 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. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/handwritten/logging/src/v2/logging_service_v2_client_config.json b/handwritten/logging/src/v2/logging_service_v2_client_config.json deleted file mode 100644 index 342e96e9b3e4..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/logging_service_v2_proto_list.json b/handwritten/logging/src/v2/logging_service_v2_proto_list.json deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/metrics_service_v2_client.ts b/handwritten/logging/src/v2/metrics_service_v2_client.ts deleted file mode 100644 index 5c00af6ca8b4..000000000000 --- a/handwritten/logging/src/v2/metrics_service_v2_client.ts +++ /dev/null @@ -1,2723 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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}; - private _universeDomain: string; - private _servicePath: string; - 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; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._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 !== this._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 = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && '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. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/handwritten/logging/src/v2/metrics_service_v2_client_config.json b/handwritten/logging/src/v2/metrics_service_v2_client_config.json deleted file mode 100644 index 014688ab775a..000000000000 --- a/handwritten/logging/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/handwritten/logging/src/v2/metrics_service_v2_proto_list.json b/handwritten/logging/src/v2/metrics_service_v2_proto_list.json deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/handwritten/logging/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/handwritten/logging/test/gapic_config_service_v2_v2.ts b/handwritten/logging/test/gapic_config_service_v2_v2.ts deleted file mode 100644 index 590ace19a7b1..000000000000 --- a/handwritten/logging/test/gapic_config_service_v2_v2.ts +++ /dev/null @@ -1,8101 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 apiEndpoint', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - configservicev2Module.v2.ConfigServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new configservicev2Module.v2.ConfigServiceV2Client({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - 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< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - > | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const operation = (await promise) as LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >; - 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< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - > | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const operation = (await promise) as LROperation< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IBucketMetadata - >; - 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< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - > | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const operation = (await promise) as LROperation< - protos.google.logging.v2.ILink, - protos.google.logging.v2.ILinkMetadata - >; - 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< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - > | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.ILinkMetadata - >; - 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< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - > | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const operation = (await promise) as LROperation< - protos.google.logging.v2.ICopyLogEntriesResponse, - protos.google.logging.v2.ICopyLogEntriesMetadata - >; - 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/handwritten/logging/test/gapic_logging_service_v2_v2.ts b/handwritten/logging/test/gapic_logging_service_v2_v2.ts deleted file mode 100644 index fd9260826268..000000000000 --- a/handwritten/logging/test/gapic_logging_service_v2_v2.ts +++ /dev/null @@ -1,3519 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 apiEndpoint', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new loggingservicev2Module.v2.LoggingServiceV2Client({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - 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/handwritten/logging/test/gapic_metrics_service_v2_v2.ts b/handwritten/logging/test/gapic_metrics_service_v2_v2.ts deleted file mode 100644 index 90a774f07657..000000000000 --- a/handwritten/logging/test/gapic_metrics_service_v2_v2.ts +++ /dev/null @@ -1,3299 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 apiEndpoint', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new metricsservicev2Module.v2.MetricsServiceV2Client({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - 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/handwritten/logging/test/index.ts b/handwritten/logging/test/index.ts index a02a18c2ccfc..73ae9f61581a 100644 --- a/handwritten/logging/test/index.ts +++ b/handwritten/logging/test/index.ts @@ -157,7 +157,7 @@ describe('Logging', () => { './log-sync': {LogSync: FakeLog}, './entry': {Entry: FakeEntry}, './sink': {Sink: FakeSink}, - './v2': fakeV2, + '@google-cloud/logging-api': fakeV2, }).Logging; });