diff --git a/handwritten/logging/.OwlBot.yaml b/handwritten/logging/.OwlBot.yaml index 360ece41c70..7f3806ae031 100644 --- a/handwritten/logging/.OwlBot.yaml +++ b/handwritten/logging/.OwlBot.yaml @@ -1,10 +1,10 @@ -# Copyright 2021 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.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 +# 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, @@ -12,13 +12,8 @@ # 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 + - source: /google/logging/google-logging-nodejs + dest: /owl-bot-staging/google-logging +api-name: logging \ No newline at end of file diff --git a/handwritten/logging/.jsdoc.js b/handwritten/logging/.jsdoc.js index 1f6bfb79190..999b4824630 100644 --- a/handwritten/logging/.jsdoc.js +++ b/handwritten/logging/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2024 Google LLC', + copyright: 'Copyright 2026 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/logging', diff --git a/handwritten/logging/protos/google/logging/type/http_request.proto b/handwritten/logging/protos/google/logging/type/http_request.proto index fa2dd64e834..b31522b69c7 100644 --- a/handwritten/logging/protos/google/logging/type/http_request.proto +++ b/handwritten/logging/protos/google/logging/type/http_request.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/protos/google/logging/type/log_severity.proto b/handwritten/logging/protos/google/logging/type/log_severity.proto index 96ff874688a..406b8173a3a 100644 --- a/handwritten/logging/protos/google/logging/type/log_severity.proto +++ b/handwritten/logging/protos/google/logging/type/log_severity.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/protos/google/logging/v2/log_entry.proto b/handwritten/logging/protos/google/logging/v2/log_entry.proto index 2404219f6aa..820b047b573 100644 --- a/handwritten/logging/protos/google/logging/v2/log_entry.proto +++ b/handwritten/logging/protos/google/logging/v2/log_entry.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/protos/google/logging/v2/logging.proto b/handwritten/logging/protos/google/logging/v2/logging.proto index cd686e9ff39..e984d6ec0d5 100644 --- a/handwritten/logging/protos/google/logging/v2/logging.proto +++ b/handwritten/logging/protos/google/logging/v2/logging.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/protos/google/logging/v2/logging_config.proto b/handwritten/logging/protos/google/logging/v2/logging_config.proto index d914df1bae5..05ed940b397 100644 --- a/handwritten/logging/protos/google/logging/v2/logging_config.proto +++ b/handwritten/logging/protos/google/logging/v2/logging_config.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/protos/google/logging/v2/logging_metrics.proto b/handwritten/logging/protos/google/logging/v2/logging_metrics.proto index a387ef2b4a5..a0575cff447 100644 --- a/handwritten/logging/protos/google/logging/v2/logging_metrics.proto +++ b/handwritten/logging/protos/google/logging/v2/logging_metrics.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.copy_log_entries.js b/handwritten/logging/samples/generated/v2/config_service_v2.copy_log_entries.js index cea748d5f79..bc4d30d85da 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.copy_log_entries.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.copy_log_entries.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, destination) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket.js index 84fd76b4d59..a7863350794 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, bucketId, bucket) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket_async.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket_async.js index 9d26cadd5c4..0cc98416c00 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket_async.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_bucket_async.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, bucketId, bucket) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_exclusion.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_exclusion.js index a5742a7b24b..b1e6a0908c8 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_exclusion.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_exclusion.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, exclusion) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_link.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_link.js index 31bcbe9b541..b2923477952 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_link.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_link.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, link, linkId) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_sink.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_sink.js index c210d088c8c..b95361847c7 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_sink.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_sink.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, sink) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.create_view.js b/handwritten/logging/samples/generated/v2/config_service_v2.create_view.js index f7aa3784891..30c237aa11d 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.create_view.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.create_view.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, viewId, view) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.delete_bucket.js b/handwritten/logging/samples/generated/v2/config_service_v2.delete_bucket.js index 7c3e0d3e7de..94443cc5870 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.delete_bucket.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.delete_bucket.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.delete_exclusion.js b/handwritten/logging/samples/generated/v2/config_service_v2.delete_exclusion.js index d0e11e39997..c6b6b2d28cc 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.delete_exclusion.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.delete_exclusion.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.delete_link.js b/handwritten/logging/samples/generated/v2/config_service_v2.delete_link.js index 61e21816f2e..c8065914749 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.delete_link.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.delete_link.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.delete_sink.js b/handwritten/logging/samples/generated/v2/config_service_v2.delete_sink.js index 57cd54a80bf..18088005bc9 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.delete_sink.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.delete_sink.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(sinkName) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.delete_view.js b/handwritten/logging/samples/generated/v2/config_service_v2.delete_view.js index 4c3ac7a4844..b99989576e7 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.delete_view.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.delete_view.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_bucket.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_bucket.js index 1bcf694211d..f85aa92d6aa 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_bucket.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_bucket.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js index 39a9c897bfe..c138860cef2 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_exclusion.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_exclusion.js index 34e779244b5..a14d73f7db6 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_exclusion.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_exclusion.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_link.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_link.js index 23afd1bbf04..54622e6ea09 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_link.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_link.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_settings.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_settings.js index 2f157e764f2..578f4e52a70 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_settings.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_settings.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_sink.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_sink.js index a27ea5ed874..5e0e2d045a7 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_sink.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_sink.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(sinkName) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.get_view.js b/handwritten/logging/samples/generated/v2/config_service_v2.get_view.js index f6851c090f3..1e7a6c23278 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.get_view.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.get_view.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.list_buckets.js b/handwritten/logging/samples/generated/v2/config_service_v2.list_buckets.js index eecf060419f..cea04327caf 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.list_buckets.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.list_buckets.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -66,7 +68,7 @@ function main(parent) { // Run request const iterable = loggingClient.listBucketsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.list_exclusions.js b/handwritten/logging/samples/generated/v2/config_service_v2.list_exclusions.js index 213a30bb660..91646b57072 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.list_exclusions.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.list_exclusions.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -63,7 +65,7 @@ function main(parent) { // Run request const iterable = loggingClient.listExclusionsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.list_links.js b/handwritten/logging/samples/generated/v2/config_service_v2.list_links.js index 09b94f34333..f2a67ec4207 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.list_links.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.list_links.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -60,7 +62,7 @@ function main(parent) { // Run request const iterable = loggingClient.listLinksAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.list_sinks.js b/handwritten/logging/samples/generated/v2/config_service_v2.list_sinks.js index e48139c6bc0..502f1ca1d79 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.list_sinks.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.list_sinks.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -63,7 +65,7 @@ function main(parent) { // Run request const iterable = loggingClient.listSinksAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.list_views.js b/handwritten/logging/samples/generated/v2/config_service_v2.list_views.js index c68583702e4..4685f8e0af5 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.list_views.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.list_views.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -60,7 +62,7 @@ function main(parent) { // Run request const iterable = loggingClient.listViewsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.undelete_bucket.js b/handwritten/logging/samples/generated/v2/config_service_v2.undelete_bucket.js index 4721db37b46..7621abdf21b 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.undelete_bucket.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.undelete_bucket.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket.js index 0d2138d8f45..2d727570f28 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, bucket, updateMask) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket_async.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket_async.js index 05cdad75cef..4748c59bf58 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket_async.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_bucket_async.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, bucket, updateMask) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js index 9f60a26a743..4372c6b45c4 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, cmekSettings) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_exclusion.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_exclusion.js index 90e9a1cf1e6..9682a7fe9b5 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_exclusion.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_exclusion.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, exclusion, updateMask) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_settings.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_settings.js index 837122b5be6..d999f34a0e8 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_settings.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_settings.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, settings) { diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_sink.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_sink.js index bb78c55d035..54b35fc5933 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_sink.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_sink.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(sinkName, sink) { @@ -43,7 +45,7 @@ function main(sinkName, sink) { */ // const sink = {} /** - * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink + * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink * for a description of this field. When updating a sink, the effect of this * field on the value of `writer_identity` in the updated sink depends on both * the old and new values of this field: diff --git a/handwritten/logging/samples/generated/v2/config_service_v2.update_view.js b/handwritten/logging/samples/generated/v2/config_service_v2.update_view.js index 6717f1d8d23..a9d9e9d5a55 100644 --- a/handwritten/logging/samples/generated/v2/config_service_v2.update_view.js +++ b/handwritten/logging/samples/generated/v2/config_service_v2.update_view.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(name, view) { diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.delete_log.js b/handwritten/logging/samples/generated/v2/logging_service_v2.delete_log.js index 4bb09342ad3..cffc95d6c8b 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.delete_log.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.delete_log.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(logName) { diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.list_log_entries.js b/handwritten/logging/samples/generated/v2/logging_service_v2.list_log_entries.js index 1857cae39b7..fc3ab769abd 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.list_log_entries.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.list_log_entries.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(resourceNames) { @@ -89,7 +91,7 @@ function main(resourceNames) { // Run request const iterable = loggingClient.listLogEntriesAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.list_logs.js b/handwritten/logging/samples/generated/v2/logging_service_v2.list_logs.js index 688d137a8de..ea22c08fb25 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.list_logs.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.list_logs.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -77,7 +79,7 @@ function main(parent) { // Run request const iterable = loggingClient.listLogsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js b/handwritten/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js index 60a67502e70..0d00fea5696 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main() { @@ -48,13 +50,13 @@ function main() { async function callListMonitoredResourceDescriptors() { // Construct request - const request = {}; + const request = { + }; // Run request - const iterable = - loggingClient.listMonitoredResourceDescriptorsAsync(request); + const iterable = loggingClient.listMonitoredResourceDescriptorsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js b/handwritten/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js index c1a4e1c9e35..c45d65d04e1 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(resourceNames) { @@ -69,15 +71,9 @@ function main(resourceNames) { // Run request const stream = await loggingClient.tailLogEntries(); - stream.on('data', response => { - console.log(response); - }); - stream.on('error', err => { - throw err; - }); - stream.on('end', () => { - /* API call completed */ - }); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); stream.write(request); stream.end(); } diff --git a/handwritten/logging/samples/generated/v2/logging_service_v2.write_log_entries.js b/handwritten/logging/samples/generated/v2/logging_service_v2.write_log_entries.js index ec3cecba66c..f6fc4e02254 100644 --- a/handwritten/logging/samples/generated/v2/logging_service_v2.write_log_entries.js +++ b/handwritten/logging/samples/generated/v2/logging_service_v2.write_log_entries.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(entries) { diff --git a/handwritten/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js b/handwritten/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js index 21144f293c1..8daaf940287 100644 --- a/handwritten/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js +++ b/handwritten/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent, metric) { diff --git a/handwritten/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js b/handwritten/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js index 162f8ab079d..0b53ce24557 100644 --- a/handwritten/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js +++ b/handwritten/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(metricName) { diff --git a/handwritten/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js b/handwritten/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js index dde0f30f8f1..ec5d653d7b7 100644 --- a/handwritten/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js +++ b/handwritten/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(metricName) { diff --git a/handwritten/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js b/handwritten/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js index 4ffff33a1bd..84325b16285 100644 --- a/handwritten/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js +++ b/handwritten/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(parent) { @@ -60,7 +62,7 @@ function main(parent) { // Run request const iterable = loggingClient.listLogMetricsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/handwritten/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js b/handwritten/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js index f414710dacf..22f8e91bf82 100644 --- a/handwritten/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js +++ b/handwritten/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** + + 'use strict'; function main(metricName, metric) { diff --git a/handwritten/logging/src/v2/config_service_v2_client.ts b/handwritten/logging/src/v2/config_service_v2_client.ts index 11d0e92a5fd..64450c3c473 100644 --- a/handwritten/logging/src/v2/config_service_v2_client.ts +++ b/handwritten/logging/src/v2/config_service_v2_client.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,9 +28,10 @@ import type { PaginationCallback, GaxCall, } from 'google-gax'; -import {Transform} from 'stream'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -52,9 +53,11 @@ export class ConfigServiceV2Client { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('logging'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -63,10 +66,10 @@ export class ConfigServiceV2Client { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - configServiceV2Stub?: Promise<{[name: string]: Function}>; + configServiceV2Stub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of ConfigServiceV2Client. @@ -90,7 +93,7 @@ export class ConfigServiceV2Client { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -142,7 +145,7 @@ export class ConfigServiceV2Client { const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -345,7 +348,7 @@ export class ConfigServiceV2Client { ), }; - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + const protoFilesRoot = this._gaxModule.protobufFromJSON(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. @@ -383,20 +386,20 @@ export class ConfigServiceV2Client { 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/*}'}, + { 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'}, + { get: '/v2/{name=projects/*/locations/*}/operations' }, + { get: '/v2/{name=organizations/*/locations/*}/operations' }, + { get: '/v2/{name=folders/*/locations/*}/operations' }, + { get: '/v2/{name=billingAccounts/*/locations/*}/operations' }, ], }, ]; @@ -468,7 +471,7 @@ export class ConfigServiceV2Client { 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, + { 'x-goog-api-client': clientHeader.join(' ') }, ); // Set up a dictionary of "inner API calls"; the core implementation @@ -508,7 +511,7 @@ export class ConfigServiceV2Client { (this._protos as any).google.logging.v2.ConfigServiceV2, this._opts, this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. @@ -548,7 +551,7 @@ export class ConfigServiceV2Client { ]; for (const methodName of configServiceV2StubMethods) { const callPromise = this.configServiceV2Stub.then( - stub => + (stub) => (...args: Array<{}>) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); @@ -755,8 +758,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getBucket(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getBucket request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getBucket response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getBucket(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IGetBucketRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBucket response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates a log bucket that can be used to store log entries. After a bucket @@ -852,8 +897,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createBucket(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createBucket request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createBucket response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createBucket(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.ICreateBucketRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createBucket response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Updates a log bucket. @@ -959,8 +1046,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateBucket(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateBucket request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateBucket response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateBucket(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IUpdateBucketRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateBucket response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Deletes a log bucket. @@ -1054,8 +1183,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteBucket(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteBucket request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteBucket response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteBucket(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteBucketRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBucket response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Undeletes a log bucket. A bucket that has been deleted can be undeleted @@ -1146,8 +1317,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.undeleteBucket(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('undeleteBucket request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('undeleteBucket response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .undeleteBucket(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IUndeleteBucketRequest | undefined, + {} | undefined, + ]) => { + this._log.info('undeleteBucket response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets a view on a log bucket.. @@ -1234,8 +1447,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getView(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getView request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getView response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getView(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IGetViewRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getView response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates a view over log entries in a log bucket. A bucket may contain a @@ -1329,8 +1584,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createView(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createView request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createView response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createView(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.ICreateViewRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createView response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Updates a view on a log bucket. This method replaces the following fields @@ -1432,8 +1729,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateView(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateView request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateView response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateView(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogView, + protos.google.logging.v2.IUpdateViewRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateView response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Deletes a view on a log bucket. @@ -1523,8 +1862,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteView(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteView request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteView response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteView(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteViewRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteView response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets a sink. @@ -1614,8 +1995,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ sink_name: request.sinkName ?? '', }); - this.initialize(); - return this.innerApiCalls.getSink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getSink request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IGetSinkRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates a sink that exports specified log entries to a destination. The @@ -1725,8 +2148,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createSink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createSink request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createSink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createSink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.ICreateSinkRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createSink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Updates a sink. This method replaces the following fields in the existing @@ -1853,8 +2318,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ sink_name: request.sinkName ?? '', }); - this.initialize(); - return this.innerApiCalls.updateSink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateSink request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateSink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateSink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogSink, + protos.google.logging.v2.IUpdateSinkRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateSink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Deletes a sink. If the sink has a unique `writer_identity`, then that @@ -1946,8 +2453,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ sink_name: request.sinkName ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteSink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteSink request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteSink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteSink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteSinkRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets a link. @@ -2033,8 +2582,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getLink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getLink request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getLink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getLink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILink, + protos.google.logging.v2.IGetLinkRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getLink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets the description of an exclusion in the _Default sink. @@ -2124,8 +2715,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getExclusion(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getExclusion request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getExclusion response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getExclusion(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IGetExclusionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getExclusion response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates a new exclusion in the _Default sink in a specified parent @@ -2221,8 +2854,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createExclusion(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createExclusion request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createExclusion response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createExclusion(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.ICreateExclusionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createExclusion response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Changes one or more properties of an existing exclusion in the _Default @@ -2325,8 +3000,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateExclusion(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateExclusion request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateExclusion response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateExclusion(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogExclusion, + protos.google.logging.v2.IUpdateExclusionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateExclusion response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Deletes an exclusion in the _Default sink. @@ -2416,8 +3133,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteExclusion(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteExclusion request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteExclusion response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteExclusion(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteExclusionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteExclusion response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets the Logging CMEK settings for the given resource. @@ -2521,8 +3280,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getCmekSettings(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getCmekSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getCmekSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getCmekSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IGetCmekSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCmekSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Updates the Log Router CMEK settings for the given resource. @@ -2646,8 +3447,52 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateCmekSettings(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateCmekSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ICmekSettings, + | protos.google.logging.v2.IUpdateCmekSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateCmekSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateCmekSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ICmekSettings, + protos.google.logging.v2.IUpdateCmekSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateCmekSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Gets the Log Router settings for the given resource. @@ -2751,8 +3596,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.getSettings(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IGetSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Updates the Log Router settings for the given resource. @@ -2872,8 +3759,50 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateSettings(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ISettings, + protos.google.logging.v2.IUpdateSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** @@ -2991,8 +3920,40 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createBucketAsync(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IBucketMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createBucketAsync response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createBucketAsync request %j', request); + return this.innerApiCalls + .createBucketAsync(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IBucketMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createBucketAsync response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } /** * Check the status of the long running operation returned by `createBucketAsync()`. @@ -3013,9 +3974,10 @@ export class ConfigServiceV2Client { protos.google.logging.v2.BucketMetadata > > { + this._log.info('createBucketAsync long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name}, + { name }, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( @@ -3152,8 +4114,40 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.updateBucketAsync(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IBucketMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateBucketAsync response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateBucketAsync request %j', request); + return this.innerApiCalls + .updateBucketAsync(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.logging.v2.ILogBucket, + protos.google.logging.v2.IBucketMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateBucketAsync response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } /** * Check the status of the long running operation returned by `updateBucketAsync()`. @@ -3174,9 +4168,10 @@ export class ConfigServiceV2Client { protos.google.logging.v2.BucketMetadata > > { + this._log.info('updateBucketAsync long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name}, + { name }, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( @@ -3301,8 +4296,40 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createLink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.logging.v2.ILink, + protos.google.logging.v2.ILinkMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createLink response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createLink request %j', request); + return this.innerApiCalls + .createLink(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.logging.v2.ILink, + protos.google.logging.v2.ILinkMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createLink response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } /** * Check the status of the long running operation returned by `createLink()`. @@ -3323,9 +4350,10 @@ export class ConfigServiceV2Client { protos.google.logging.v2.LinkMetadata > > { + this._log.info('createLink long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name}, + { name }, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( @@ -3443,8 +4471,40 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteLink(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.ILinkMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteLink response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteLink request %j', request); + return this.innerApiCalls + .deleteLink(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.ILinkMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteLink response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } /** * Check the status of the long running operation returned by `deleteLink()`. @@ -3465,9 +4525,10 @@ export class ConfigServiceV2Client { protos.google.logging.v2.LinkMetadata > > { + this._log.info('deleteLink long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name}, + { name }, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( @@ -3584,8 +4645,40 @@ export class ConfigServiceV2Client { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.copyLogEntries(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.logging.v2.ICopyLogEntriesResponse, + protos.google.logging.v2.ICopyLogEntriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('copyLogEntries response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('copyLogEntries request %j', request); + return this.innerApiCalls + .copyLogEntries(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.logging.v2.ICopyLogEntriesResponse, + protos.google.logging.v2.ICopyLogEntriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('copyLogEntries response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } /** * Check the status of the long running operation returned by `copyLogEntries()`. @@ -3606,9 +4699,10 @@ export class ConfigServiceV2Client { protos.google.logging.v2.CopyLogEntriesMetadata > > { + this._log.info('copyLogEntries long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name}, + { name }, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( @@ -3721,12 +4815,38 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listBuckets(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListBucketsRequest, + protos.google.logging.v2.IListBucketsResponse | null | undefined, + protos.google.logging.v2.ILogBucket + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listBuckets values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listBuckets request %j', request); + return this.innerApiCalls + .listBuckets(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogBucket[], + protos.google.logging.v2.IListBucketsRequest | null, + protos.google.logging.v2.IListBucketsResponse, + ]) => { + this._log.info('listBuckets values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listBuckets`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -3774,7 +4894,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listBuckets']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBuckets stream %j', request); return this.descriptors.page.listBuckets.createStream( this.innerApiCalls.listBuckets as GaxCall, request, @@ -3834,7 +4957,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listBuckets']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBuckets iterate %j', request); return this.descriptors.page.listBuckets.asyncIterate( this.innerApiCalls['listBuckets'] as GaxCall, request as {}, @@ -3935,12 +5061,38 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listViews(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListViewsRequest, + protos.google.logging.v2.IListViewsResponse | null | undefined, + protos.google.logging.v2.ILogView + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listViews values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listViews request %j', request); + return this.innerApiCalls + .listViews(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogView[], + protos.google.logging.v2.IListViewsRequest | null, + protos.google.logging.v2.IListViewsResponse, + ]) => { + this._log.info('listViews values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listViews`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -3982,7 +5134,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listViews']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listViews stream %j', request); return this.descriptors.page.listViews.createStream( this.innerApiCalls.listViews as GaxCall, request, @@ -4036,7 +5191,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listViews']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listViews iterate %j', request); return this.descriptors.page.listViews.asyncIterate( this.innerApiCalls['listViews'] as GaxCall, request as {}, @@ -4139,12 +5297,38 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listSinks(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListSinksRequest, + protos.google.logging.v2.IListSinksResponse | null | undefined, + protos.google.logging.v2.ILogSink + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSinks values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSinks request %j', request); + return this.innerApiCalls + .listSinks(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogSink[], + protos.google.logging.v2.IListSinksRequest | null, + protos.google.logging.v2.IListSinksResponse, + ]) => { + this._log.info('listSinks values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listSinks`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -4188,7 +5372,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listSinks']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSinks stream %j', request); return this.descriptors.page.listSinks.createStream( this.innerApiCalls.listSinks as GaxCall, request, @@ -4244,7 +5431,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listSinks']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSinks iterate %j', request); return this.descriptors.page.listSinks.asyncIterate( this.innerApiCalls['listSinks'] as GaxCall, request as {}, @@ -4344,12 +5534,38 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listLinks(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListLinksRequest, + protos.google.logging.v2.IListLinksResponse | null | undefined, + protos.google.logging.v2.ILink + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listLinks values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listLinks request %j', request); + return this.innerApiCalls + .listLinks(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILink[], + protos.google.logging.v2.IListLinksRequest | null, + protos.google.logging.v2.IListLinksResponse, + ]) => { + this._log.info('listLinks values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listLinks`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -4390,7 +5606,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listLinks']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLinks stream %j', request); return this.descriptors.page.listLinks.createStream( this.innerApiCalls.listLinks as GaxCall, request, @@ -4443,7 +5662,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listLinks']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLinks iterate %j', request); return this.descriptors.page.listLinks.asyncIterate( this.innerApiCalls['listLinks'] as GaxCall, request as {}, @@ -4546,12 +5768,38 @@ export class ConfigServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listExclusions(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListExclusionsRequest, + protos.google.logging.v2.IListExclusionsResponse | null | undefined, + protos.google.logging.v2.ILogExclusion + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listExclusions values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listExclusions request %j', request); + return this.innerApiCalls + .listExclusions(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogExclusion[], + protos.google.logging.v2.IListExclusionsRequest | null, + protos.google.logging.v2.IListExclusionsResponse, + ]) => { + this._log.info('listExclusions values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listExclusions`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -4595,7 +5843,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listExclusions']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listExclusions stream %j', request); return this.descriptors.page.listExclusions.createStream( this.innerApiCalls.listExclusions as GaxCall, request, @@ -4651,7 +5902,10 @@ export class ConfigServiceV2Client { }); const defaultCallSettings = this._defaults['listExclusions']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listExclusions iterate %j', request); return this.descriptors.page.listExclusions.asyncIterate( this.innerApiCalls['listExclusions'] as GaxCall, request as {}, @@ -4690,7 +5944,7 @@ export class ConfigServiceV2Client { */ getOperation( request: protos.google.longrunning.GetOperationRequest, - options?: + optionsOrCallback?: | gax.CallOptions | Callback< protos.google.longrunning.Operation, @@ -4703,6 +5957,20 @@ export class ConfigServiceV2Client { {} | null | undefined >, ): Promise<[protos.google.longrunning.Operation]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -4738,7 +6006,14 @@ export class ConfigServiceV2Client { listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions, - ): AsyncIterable { + ): AsyncIterable { + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -4774,11 +6049,11 @@ export class ConfigServiceV2Client { */ cancelOperation( request: protos.google.longrunning.CancelOperationRequest, - options?: + optionsOrCallback?: | gax.CallOptions | Callback< - protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, {} | undefined | null >, callback?: Callback< @@ -4787,9 +6062,22 @@ export class ConfigServiceV2Client { {} | undefined | null >, ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -4817,7 +6105,7 @@ export class ConfigServiceV2Client { */ deleteOperation( request: protos.google.longrunning.DeleteOperationRequest, - options?: + optionsOrCallback?: | gax.CallOptions | Callback< protos.google.protobuf.Empty, @@ -4830,6 +6118,20 @@ export class ConfigServiceV2Client { {} | null | undefined >, ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -6541,10 +7843,11 @@ export class ConfigServiceV2Client { */ close(): Promise { if (this.configServiceV2Stub && !this._terminated) { - return this.configServiceV2Stub.then(stub => { + return this.configServiceV2Stub.then((stub) => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.operationsClient.close(); + void this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/handwritten/logging/src/v2/index.ts b/handwritten/logging/src/v2/index.ts index 2cc712044a0..2aca5a517ff 100644 --- a/handwritten/logging/src/v2/index.ts +++ b/handwritten/logging/src/v2/index.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,6 @@ // ** 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'; +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 index 5995243420c..15ed400567b 100644 --- a/handwritten/logging/src/v2/logging_service_v2_client.ts +++ b/handwritten/logging/src/v2/logging_service_v2_client.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,9 +26,10 @@ import type { PaginationCallback, GaxCall, } from 'google-gax'; -import {Transform, PassThrough} from 'stream'; +import { Transform, PassThrough } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -50,9 +51,11 @@ export class LoggingServiceV2Client { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('logging'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -61,9 +64,9 @@ export class LoggingServiceV2Client { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - loggingServiceV2Stub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + loggingServiceV2Stub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of LoggingServiceV2Client. @@ -87,7 +90,7 @@ export class LoggingServiceV2Client { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -139,7 +142,7 @@ export class LoggingServiceV2Client { const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -339,7 +342,7 @@ export class LoggingServiceV2Client { ), }; - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); // Some methods on this API support automatically batching // requests; denote this. @@ -360,7 +363,7 @@ export class LoggingServiceV2Client { 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, + { 'x-goog-api-client': clientHeader.join(' ') }, ); // Set up a dictionary of "inner API calls"; the core implementation @@ -400,7 +403,7 @@ export class LoggingServiceV2Client { (this._protos as any).google.logging.v2.LoggingServiceV2, this._opts, this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. @@ -414,11 +417,11 @@ export class LoggingServiceV2Client { ]; for (const methodName of loggingServiceV2StubMethods) { const callPromise = this.loggingServiceV2Stub.then( - stub => + (stub) => (...args: Array<{}>) => { if (this._terminated) { if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); + const stream = new PassThrough({ objectMode: true }); setImmediate(() => { stream.emit( 'error', @@ -641,8 +644,50 @@ export class LoggingServiceV2Client { this._gaxModule.routingHeader.fromParams({ log_name: request.logName ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteLog(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteLog request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteLog response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteLog(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteLog response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Writes log entries to Logging. This API method is the @@ -792,8 +837,50 @@ export class LoggingServiceV2Client { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.writeLogEntries(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('writeLogEntries request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('writeLogEntries response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .writeLogEntries(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.IWriteLogEntriesResponse, + protos.google.logging.v2.IWriteLogEntriesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('writeLogEntries response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** @@ -812,7 +899,10 @@ export class LoggingServiceV2Client { * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async */ tailLogEntries(options?: CallOptions): gax.CancellableStream { - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('tailLogEntries stream %j', options); return this.innerApiCalls.tailLogEntries(null, options); } @@ -936,12 +1026,38 @@ export class LoggingServiceV2Client { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.listLogEntries(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListLogEntriesRequest, + protos.google.logging.v2.IListLogEntriesResponse | null | undefined, + protos.google.logging.v2.ILogEntry + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listLogEntries values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listLogEntries request %j', request); + return this.innerApiCalls + .listLogEntries(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogEntry[], + protos.google.logging.v2.IListLogEntriesRequest | null, + protos.google.logging.v2.IListLogEntriesResponse, + ]) => { + this._log.info('listLogEntries values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listLogEntries`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string[]} request.resourceNames @@ -1006,7 +1122,10 @@ export class LoggingServiceV2Client { options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listLogEntries']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogEntries stream %j', request); return this.descriptors.page.listLogEntries.createStream( this.innerApiCalls.listLogEntries as GaxCall, request, @@ -1083,7 +1202,10 @@ export class LoggingServiceV2Client { options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listLogEntries']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogEntries iterate %j', request); return this.descriptors.page.listLogEntries.asyncIterate( this.innerApiCalls['listLogEntries'] as GaxCall, request as {}, @@ -1183,16 +1305,43 @@ export class LoggingServiceV2Client { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.listMonitoredResourceDescriptors( - request, - options, - callback, - ); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, + | protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listMonitoredResourceDescriptors values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listMonitoredResourceDescriptors request %j', request); + return this.innerApiCalls + .listMonitoredResourceDescriptors(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest | null, + protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse, + ]) => { + this._log.info( + 'listMonitoredResourceDescriptors values %j', + response, + ); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {number} [request.pageSize] @@ -1226,7 +1375,10 @@ export class LoggingServiceV2Client { const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listMonitoredResourceDescriptors stream %j', request); return this.descriptors.page.listMonitoredResourceDescriptors.createStream( this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, request, @@ -1272,7 +1424,10 @@ export class LoggingServiceV2Client { const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listMonitoredResourceDescriptors iterate %j', request); return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, request as {}, @@ -1392,12 +1547,38 @@ export class LoggingServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listLogs(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListLogsRequest, + protos.google.logging.v2.IListLogsResponse | null | undefined, + string + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listLogs values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listLogs request %j', request); + return this.innerApiCalls + .listLogs(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + string[], + protos.google.logging.v2.IListLogsRequest | null, + protos.google.logging.v2.IListLogsResponse, + ]) => { + this._log.info('listLogs values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listLogs`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1457,7 +1638,10 @@ export class LoggingServiceV2Client { }); const defaultCallSettings = this._defaults['listLogs']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogs stream %j', request); return this.descriptors.page.listLogs.createStream( this.innerApiCalls.listLogs as GaxCall, request, @@ -1529,7 +1713,10 @@ export class LoggingServiceV2Client { }); const defaultCallSettings = this._defaults['listLogs']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogs iterate %j', request); return this.descriptors.page.listLogs.asyncIterate( this.innerApiCalls['listLogs'] as GaxCall, request as {}, @@ -3208,7 +3395,8 @@ export class LoggingServiceV2Client { */ close(): Promise { if (this.loggingServiceV2Stub && !this._terminated) { - return this.loggingServiceV2Stub.then(stub => { + return this.loggingServiceV2Stub.then((stub) => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); }); diff --git a/handwritten/logging/src/v2/metrics_service_v2_client.ts b/handwritten/logging/src/v2/metrics_service_v2_client.ts index 5c00af6ca8b..3c0ff03971c 100644 --- a/handwritten/logging/src/v2/metrics_service_v2_client.ts +++ b/handwritten/logging/src/v2/metrics_service_v2_client.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,9 +26,10 @@ import type { PaginationCallback, GaxCall, } from 'google-gax'; -import {Transform} from 'stream'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -50,9 +51,11 @@ export class MetricsServiceV2Client { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('logging'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -61,9 +64,9 @@ export class MetricsServiceV2Client { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricsServiceV2Stub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + metricsServiceV2Stub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of MetricsServiceV2Client. @@ -87,7 +90,7 @@ export class MetricsServiceV2Client { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -139,7 +142,7 @@ export class MetricsServiceV2Client { const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -324,7 +327,7 @@ export class MetricsServiceV2Client { 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, + { 'x-goog-api-client': clientHeader.join(' ') }, ); // Set up a dictionary of "inner API calls"; the core implementation @@ -364,7 +367,7 @@ export class MetricsServiceV2Client { (this._protos as any).google.logging.v2.MetricsServiceV2, this._opts, this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. @@ -377,7 +380,7 @@ export class MetricsServiceV2Client { ]; for (const methodName of metricsServiceV2StubMethods) { const callPromise = this.metricsServiceV2Stub.then( - stub => + (stub) => (...args: Array<{}>) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); @@ -575,8 +578,50 @@ export class MetricsServiceV2Client { this._gaxModule.routingHeader.fromParams({ metric_name: request.metricName ?? '', }); - this.initialize(); - return this.innerApiCalls.getLogMetric(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getLogMetric request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getLogMetric response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getLogMetric(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IGetLogMetricRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getLogMetric response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates a logs-based metric. @@ -664,8 +709,50 @@ export class MetricsServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.createLogMetric(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createLogMetric request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createLogMetric response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createLogMetric(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.ICreateLogMetricRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createLogMetric response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Creates or updates a logs-based metric. @@ -754,8 +841,50 @@ export class MetricsServiceV2Client { this._gaxModule.routingHeader.fromParams({ metric_name: request.metricName ?? '', }); - this.initialize(); - return this.innerApiCalls.updateLogMetric(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateLogMetric request %j', request); + const wrappedCallback: + | Callback< + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateLogMetric response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateLogMetric(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.logging.v2.ILogMetric, + protos.google.logging.v2.IUpdateLogMetricRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateLogMetric response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** * Deletes a logs-based metric. @@ -838,8 +967,50 @@ export class MetricsServiceV2Client { this._gaxModule.routingHeader.fromParams({ metric_name: request.metricName ?? '', }); - this.initialize(); - return this.innerApiCalls.deleteLogMetric(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteLogMetric request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteLogMetric response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteLogMetric(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.logging.v2.IDeleteLogMetricRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteLogMetric response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); } /** @@ -935,12 +1106,38 @@ export class MetricsServiceV2Client { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - this.initialize(); - return this.innerApiCalls.listLogMetrics(request, options, callback); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.logging.v2.IListLogMetricsRequest, + protos.google.logging.v2.IListLogMetricsResponse | null | undefined, + protos.google.logging.v2.ILogMetric + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listLogMetrics values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listLogMetrics request %j', request); + return this.innerApiCalls + .listLogMetrics(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.logging.v2.ILogMetric[], + protos.google.logging.v2.IListLogMetricsRequest | null, + protos.google.logging.v2.IListLogMetricsResponse, + ]) => { + this._log.info('listLogMetrics values %j', response); + return [response, input, output]; + }, + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listLogMetrics`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -981,7 +1178,10 @@ export class MetricsServiceV2Client { }); const defaultCallSettings = this._defaults['listLogMetrics']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogMetrics stream %j', request); return this.descriptors.page.listLogMetrics.createStream( this.innerApiCalls.listLogMetrics as GaxCall, request, @@ -1034,7 +1234,10 @@ export class MetricsServiceV2Client { }); const defaultCallSettings = this._defaults['listLogMetrics']; const callSettings = defaultCallSettings.merge(options); - this.initialize(); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listLogMetrics iterate %j', request); return this.descriptors.page.listLogMetrics.asyncIterate( this.innerApiCalls['listLogMetrics'] as GaxCall, request as {}, @@ -2713,7 +2916,8 @@ export class MetricsServiceV2Client { */ close(): Promise { if (this.metricsServiceV2Stub && !this._terminated) { - return this.metricsServiceV2Stub.then(stub => { + return this.metricsServiceV2Stub.then((stub) => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); }); diff --git a/handwritten/logging/system-test/install.ts b/handwritten/logging/system-test/install.ts index 22bbd83361c..ccf167042d2 100644 --- a/handwritten/logging/system-test/install.ts +++ b/handwritten/logging/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { it('TypeScript code', async function () { @@ -41,7 +41,7 @@ describe('📦 pack-n-play test', () => { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync( + cjs: readFileSync( './system-test/fixtures/sample/src/index.js', ).toString(), }, diff --git a/handwritten/logging/test/gapic_config_service_v2_v2.ts b/handwritten/logging/test/gapic_config_service_v2_v2.ts index 590ace19a7b..74d54c9ce69 100644 --- a/handwritten/logging/test/gapic_config_service_v2_v2.ts +++ b/handwritten/logging/test/gapic_config_service_v2_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as configservicev2Module from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +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 @@ -45,7 +45,7 @@ function getTypeDefaultValue(typeName: string, fields: string[]) { function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); + ).toObject(instance as protobuf.Message, { defaults: true }); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject, ) as T; @@ -149,9 +149,9 @@ function stubAsyncIterationCall( return Promise.reject(error); } if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); + return Promise.resolve({ done: true, value: undefined }); } - return Promise.resolve({done: false, value: responses![counter++]}); + return Promise.resolve({ done: false, value: responses![counter++] }); }, }; }, @@ -271,7 +271,7 @@ describe('v2.ConfigServiceV2Client', () => { it('has initialize method and supports deferred initialization', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.configServiceV2Stub, undefined); @@ -279,33 +279,45 @@ describe('v2.ConfigServiceV2Client', () => { assert(client.configServiceV2Stub); }); - it('has close method for the initialized client', done => { + it('has close method for the initialized client', (done) => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); - assert(client.configServiceV2Stub); - client.close().then(() => { - done(); + client.initialize().catch((err) => { + throw err; }); + assert(client.configServiceV2Stub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); - it('has close method for the non-initialized client', done => { + it('has close method for the non-initialized client', (done) => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.configServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); @@ -317,7 +329,7 @@ describe('v2.ConfigServiceV2Client', () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon @@ -340,10 +352,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getBucket', () => { it('invokes getBucket without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetBucketRequest(), ); @@ -352,7 +364,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -371,10 +383,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getBucket without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetBucketRequest(), ); @@ -383,7 +395,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -418,10 +430,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getBucket with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetBucketRequest(), ); @@ -430,7 +442,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getBucket(request), expectedError); @@ -446,10 +458,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getBucket with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetBucketRequest(), ); @@ -459,7 +471,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getBucket(request), expectedError); }); }); @@ -467,10 +481,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createBucket', () => { it('invokes createBucket without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -479,7 +493,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -498,10 +512,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucket without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -510,7 +524,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -545,10 +559,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucket with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -557,7 +571,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createBucket = stubSimpleCall( undefined, @@ -576,10 +590,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucket with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -589,7 +603,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.createBucket(request), expectedError); }); }); @@ -597,10 +613,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateBucket', () => { it('invokes updateBucket without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -609,7 +625,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -628,10 +644,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucket without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -640,7 +656,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogBucket(), ); @@ -675,10 +691,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucket with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -687,7 +703,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateBucket = stubSimpleCall( undefined, @@ -706,10 +722,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucket with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -719,7 +735,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateBucket(request), expectedError); }); }); @@ -727,10 +745,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteBucket', () => { it('invokes deleteBucket without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteBucketRequest(), ); @@ -739,7 +757,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -758,10 +776,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteBucket without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteBucketRequest(), ); @@ -770,7 +788,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -805,10 +823,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteBucket with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteBucketRequest(), ); @@ -817,7 +835,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteBucket = stubSimpleCall( undefined, @@ -836,10 +854,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteBucket with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteBucketRequest(), ); @@ -849,7 +867,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteBucket(request), expectedError); }); }); @@ -857,10 +877,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('undeleteBucket', () => { it('invokes undeleteBucket without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UndeleteBucketRequest(), ); @@ -869,7 +889,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -888,10 +908,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes undeleteBucket without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UndeleteBucketRequest(), ); @@ -900,7 +920,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -935,10 +955,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes undeleteBucket with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UndeleteBucketRequest(), ); @@ -947,7 +967,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.undeleteBucket = stubSimpleCall( undefined, @@ -966,10 +986,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes undeleteBucket with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UndeleteBucketRequest(), ); @@ -979,7 +999,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.undeleteBucket(request), expectedError); }); }); @@ -987,10 +1009,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getView', () => { it('invokes getView without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetViewRequest(), ); @@ -999,7 +1021,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1018,10 +1040,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getView without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetViewRequest(), ); @@ -1030,7 +1052,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1065,10 +1087,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getView with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetViewRequest(), ); @@ -1077,7 +1099,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getView(request), expectedError); @@ -1093,10 +1115,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getView with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetViewRequest(), ); @@ -1106,7 +1128,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getView(request), expectedError); }); }); @@ -1114,10 +1138,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createView', () => { it('invokes createView without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateViewRequest(), ); @@ -1126,7 +1150,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1145,10 +1169,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createView without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateViewRequest(), ); @@ -1157,7 +1181,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1192,10 +1216,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createView with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateViewRequest(), ); @@ -1204,7 +1228,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createView = stubSimpleCall( undefined, @@ -1223,10 +1247,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createView with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateViewRequest(), ); @@ -1236,7 +1260,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.createView(request), expectedError); }); }); @@ -1244,10 +1270,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateView', () => { it('invokes updateView without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateViewRequest(), ); @@ -1256,7 +1282,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1275,10 +1301,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateView without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateViewRequest(), ); @@ -1287,7 +1313,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogView(), ); @@ -1322,10 +1348,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateView with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateViewRequest(), ); @@ -1334,7 +1360,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateView = stubSimpleCall( undefined, @@ -1353,10 +1379,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateView with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateViewRequest(), ); @@ -1366,7 +1392,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateView(request), expectedError); }); }); @@ -1374,10 +1402,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteView', () => { it('invokes deleteView without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteViewRequest(), ); @@ -1386,7 +1414,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -1405,10 +1433,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteView without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteViewRequest(), ); @@ -1417,7 +1445,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -1452,10 +1480,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteView with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteViewRequest(), ); @@ -1464,7 +1492,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteView = stubSimpleCall( undefined, @@ -1483,10 +1511,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteView with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteViewRequest(), ); @@ -1496,7 +1524,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteView(request), expectedError); }); }); @@ -1504,10 +1534,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getSink', () => { it('invokes getSink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSinkRequest(), ); @@ -1516,7 +1546,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1535,10 +1565,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSinkRequest(), ); @@ -1547,7 +1577,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1582,10 +1612,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSink with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSinkRequest(), ); @@ -1594,7 +1624,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getSink(request), expectedError); @@ -1610,10 +1640,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSink with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSinkRequest(), ); @@ -1623,7 +1653,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.sinkName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getSink(request), expectedError); }); }); @@ -1631,10 +1663,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createSink', () => { it('invokes createSink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateSinkRequest(), ); @@ -1643,7 +1675,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1662,10 +1694,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createSink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateSinkRequest(), ); @@ -1674,7 +1706,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1709,10 +1741,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createSink with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateSinkRequest(), ); @@ -1721,7 +1753,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createSink = stubSimpleCall( undefined, @@ -1740,10 +1772,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createSink with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateSinkRequest(), ); @@ -1753,7 +1785,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.createSink(request), expectedError); }); }); @@ -1761,10 +1795,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateSink', () => { it('invokes updateSink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSinkRequest(), ); @@ -1773,7 +1807,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1792,10 +1826,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSinkRequest(), ); @@ -1804,7 +1838,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogSink(), ); @@ -1839,10 +1873,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSink with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSinkRequest(), ); @@ -1851,7 +1885,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateSink = stubSimpleCall( undefined, @@ -1870,10 +1904,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSink with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSinkRequest(), ); @@ -1883,7 +1917,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.sinkName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateSink(request), expectedError); }); }); @@ -1891,10 +1927,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteSink', () => { it('invokes deleteSink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteSinkRequest(), ); @@ -1903,7 +1939,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -1922,10 +1958,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteSink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteSinkRequest(), ); @@ -1934,7 +1970,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -1969,10 +2005,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteSink with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteSinkRequest(), ); @@ -1981,7 +2017,7 @@ describe('v2.ConfigServiceV2Client', () => { ['sinkName'], ); request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1}`; + const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteSink = stubSimpleCall( undefined, @@ -2000,10 +2036,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteSink with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteSinkRequest(), ); @@ -2013,7 +2049,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.sinkName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteSink(request), expectedError); }); }); @@ -2021,10 +2059,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getLink', () => { it('invokes getLink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLinkRequest(), ); @@ -2033,7 +2071,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Link(), ); @@ -2052,10 +2090,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getLink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLinkRequest(), ); @@ -2064,7 +2102,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Link(), ); @@ -2099,10 +2137,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getLink with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLinkRequest(), ); @@ -2111,7 +2149,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getLink = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getLink(request), expectedError); @@ -2127,10 +2165,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getLink with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLinkRequest(), ); @@ -2140,7 +2178,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getLink(request), expectedError); }); }); @@ -2148,10 +2188,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getExclusion', () => { it('invokes getExclusion without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetExclusionRequest(), ); @@ -2160,7 +2200,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2179,10 +2219,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getExclusion without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetExclusionRequest(), ); @@ -2191,7 +2231,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2226,10 +2266,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getExclusion with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetExclusionRequest(), ); @@ -2238,7 +2278,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getExclusion = stubSimpleCall( undefined, @@ -2257,10 +2297,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getExclusion with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetExclusionRequest(), ); @@ -2270,7 +2310,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getExclusion(request), expectedError); }); }); @@ -2278,10 +2320,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createExclusion', () => { it('invokes createExclusion without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateExclusionRequest(), ); @@ -2290,7 +2332,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2309,10 +2351,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createExclusion without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateExclusionRequest(), ); @@ -2321,7 +2363,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2356,10 +2398,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createExclusion with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateExclusionRequest(), ); @@ -2368,7 +2410,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createExclusion = stubSimpleCall( undefined, @@ -2387,10 +2429,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createExclusion with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateExclusionRequest(), ); @@ -2400,7 +2442,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.createExclusion(request), expectedError); }); }); @@ -2408,10 +2452,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateExclusion', () => { it('invokes updateExclusion without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateExclusionRequest(), ); @@ -2420,7 +2464,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2439,10 +2483,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateExclusion without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateExclusionRequest(), ); @@ -2451,7 +2495,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogExclusion(), ); @@ -2486,10 +2530,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateExclusion with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateExclusionRequest(), ); @@ -2498,7 +2542,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateExclusion = stubSimpleCall( undefined, @@ -2517,10 +2561,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateExclusion with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateExclusionRequest(), ); @@ -2530,7 +2574,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateExclusion(request), expectedError); }); }); @@ -2538,10 +2584,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteExclusion', () => { it('invokes deleteExclusion without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteExclusionRequest(), ); @@ -2550,7 +2596,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -2569,10 +2615,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteExclusion without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteExclusionRequest(), ); @@ -2581,7 +2627,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -2616,10 +2662,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteExclusion with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteExclusionRequest(), ); @@ -2628,7 +2674,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteExclusion = stubSimpleCall( undefined, @@ -2647,10 +2693,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteExclusion with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteExclusionRequest(), ); @@ -2660,7 +2706,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteExclusion(request), expectedError); }); }); @@ -2668,10 +2716,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getCmekSettings', () => { it('invokes getCmekSettings without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetCmekSettingsRequest(), ); @@ -2680,7 +2728,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.CmekSettings(), ); @@ -2699,10 +2747,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getCmekSettings without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetCmekSettingsRequest(), ); @@ -2711,7 +2759,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.CmekSettings(), ); @@ -2746,10 +2794,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getCmekSettings with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetCmekSettingsRequest(), ); @@ -2758,7 +2806,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getCmekSettings = stubSimpleCall( undefined, @@ -2777,10 +2825,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getCmekSettings with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetCmekSettingsRequest(), ); @@ -2790,7 +2838,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getCmekSettings(request), expectedError); }); }); @@ -2798,10 +2848,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateCmekSettings', () => { it('invokes updateCmekSettings without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateCmekSettingsRequest(), ); @@ -2810,7 +2860,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.CmekSettings(), ); @@ -2830,10 +2880,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateCmekSettings without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateCmekSettingsRequest(), ); @@ -2842,7 +2892,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.CmekSettings(), ); @@ -2877,10 +2927,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateCmekSettings with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateCmekSettingsRequest(), ); @@ -2889,7 +2939,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCmekSettings = stubSimpleCall( undefined, @@ -2908,10 +2958,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateCmekSettings with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateCmekSettingsRequest(), ); @@ -2921,7 +2971,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateCmekSettings(request), expectedError); }); }); @@ -2929,10 +2981,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getSettings', () => { it('invokes getSettings without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSettingsRequest(), ); @@ -2941,7 +2993,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Settings(), ); @@ -2960,10 +3012,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSettings without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSettingsRequest(), ); @@ -2972,7 +3024,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Settings(), ); @@ -3007,10 +3059,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSettings with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSettingsRequest(), ); @@ -3019,7 +3071,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getSettings = stubSimpleCall( undefined, @@ -3038,10 +3090,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes getSettings with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetSettingsRequest(), ); @@ -3051,7 +3103,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getSettings(request), expectedError); }); }); @@ -3059,10 +3113,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateSettings', () => { it('invokes updateSettings without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSettingsRequest(), ); @@ -3071,7 +3125,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Settings(), ); @@ -3090,10 +3144,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSettings without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSettingsRequest(), ); @@ -3102,7 +3156,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.Settings(), ); @@ -3137,10 +3191,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSettings with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSettingsRequest(), ); @@ -3149,7 +3203,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateSettings = stubSimpleCall( undefined, @@ -3168,10 +3222,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateSettings with closed client', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateSettingsRequest(), ); @@ -3181,7 +3235,9 @@ describe('v2.ConfigServiceV2Client', () => { ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateSettings(request), expectedError); }); }); @@ -3189,10 +3245,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createBucketAsync', () => { it('invokes createBucketAsync without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -3201,7 +3257,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3222,10 +3278,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucketAsync without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -3234,7 +3290,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3276,10 +3332,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucketAsync with call error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -3288,7 +3344,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createBucketAsync = stubLongRunningCall( undefined, @@ -3307,10 +3363,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createBucketAsync with LRO error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateBucketRequest(), ); @@ -3319,7 +3375,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createBucketAsync = stubLongRunningCall( undefined, @@ -3340,16 +3396,16 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCreateBucketAsyncProgress without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await 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('')}; + 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( @@ -3362,10 +3418,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCreateBucketAsyncProgress with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( @@ -3383,10 +3439,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('updateBucketAsync', () => { it('invokes updateBucketAsync without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -3395,7 +3451,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3416,10 +3472,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucketAsync without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -3428,7 +3484,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3470,10 +3526,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucketAsync with call error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -3482,7 +3538,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateBucketAsync = stubLongRunningCall( undefined, @@ -3501,10 +3557,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes updateBucketAsync with LRO error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateBucketRequest(), ); @@ -3513,7 +3569,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateBucketAsync = stubLongRunningCall( undefined, @@ -3534,16 +3590,16 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkUpdateBucketAsyncProgress without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await 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('')}; + 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( @@ -3556,10 +3612,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkUpdateBucketAsyncProgress with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( @@ -3577,10 +3633,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('createLink', () => { it('invokes createLink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLinkRequest(), ); @@ -3589,7 +3645,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3609,10 +3665,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createLink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLinkRequest(), ); @@ -3621,7 +3677,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3663,10 +3719,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createLink with call error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLinkRequest(), ); @@ -3675,7 +3731,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createLink = stubLongRunningCall( undefined, @@ -3694,10 +3750,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes createLink with LRO error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLinkRequest(), ); @@ -3706,7 +3762,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createLink = stubLongRunningCall( undefined, @@ -3727,16 +3783,16 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCreateLinkProgress without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await 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('')}; + 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( @@ -3749,10 +3805,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCreateLinkProgress with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( @@ -3767,10 +3823,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteLink', () => { it('invokes deleteLink without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLinkRequest(), ); @@ -3779,7 +3835,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3799,10 +3855,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteLink without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLinkRequest(), ); @@ -3811,7 +3867,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation(), ); @@ -3853,10 +3909,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteLink with call error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLinkRequest(), ); @@ -3865,7 +3921,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteLink = stubLongRunningCall( undefined, @@ -3884,10 +3940,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes deleteLink with LRO error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLinkRequest(), ); @@ -3896,7 +3952,7 @@ describe('v2.ConfigServiceV2Client', () => { ['name'], ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteLink = stubLongRunningCall( undefined, @@ -3917,16 +3973,16 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkDeleteLinkProgress without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await 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('')}; + 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( @@ -3939,10 +3995,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkDeleteLinkProgress with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( @@ -3957,10 +4013,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('copyLogEntries', () => { it('invokes copyLogEntries without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CopyLogEntriesRequest(), ); @@ -3976,10 +4032,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes copyLogEntries without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CopyLogEntriesRequest(), ); @@ -4016,10 +4072,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes copyLogEntries with call error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CopyLogEntriesRequest(), ); @@ -4033,10 +4089,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes copyLogEntries with LRO error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CopyLogEntriesRequest(), ); @@ -4052,16 +4108,16 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCopyLogEntriesProgress without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await 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('')}; + 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( @@ -4074,10 +4130,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes checkCopyLogEntriesProgress with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( @@ -4095,10 +4151,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('listBuckets', () => { it('invokes listBuckets without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4107,7 +4163,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogBucket()), generateSampleMessage(new protos.google.logging.v2.LogBucket()), @@ -4128,10 +4184,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listBuckets without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4140,7 +4196,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogBucket()), generateSampleMessage(new protos.google.logging.v2.LogBucket()), @@ -4177,10 +4233,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listBuckets with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4189,7 +4245,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listBuckets = stubSimpleCall( undefined, @@ -4208,10 +4264,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listBucketsStream without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4220,7 +4276,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogBucket()), generateSampleMessage(new protos.google.logging.v2.LogBucket()), @@ -4259,10 +4315,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listBucketsStream with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4271,7 +4327,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listBuckets.createStream = stubPageStreamingCall( undefined, @@ -4307,10 +4363,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listBuckets without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4319,7 +4375,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogBucket()), generateSampleMessage(new protos.google.logging.v2.LogBucket()), @@ -4350,10 +4406,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listBuckets with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListBucketsRequest(), ); @@ -4362,7 +4418,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall( undefined, @@ -4394,10 +4450,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('listViews', () => { it('invokes listViews without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4406,7 +4462,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogView()), generateSampleMessage(new protos.google.logging.v2.LogView()), @@ -4427,10 +4483,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listViews without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4439,7 +4495,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogView()), generateSampleMessage(new protos.google.logging.v2.LogView()), @@ -4476,10 +4532,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listViews with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4488,7 +4544,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listViews(request), expectedError); @@ -4504,10 +4560,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listViewsStream without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4516,7 +4572,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogView()), generateSampleMessage(new protos.google.logging.v2.LogView()), @@ -4555,10 +4611,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listViewsStream with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4567,7 +4623,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listViews.createStream = stubPageStreamingCall( undefined, @@ -4603,10 +4659,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listViews without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4615,7 +4671,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogView()), generateSampleMessage(new protos.google.logging.v2.LogView()), @@ -4645,10 +4701,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listViews with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListViewsRequest(), ); @@ -4657,7 +4713,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall( undefined, @@ -4688,10 +4744,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('listSinks', () => { it('invokes listSinks without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4700,7 +4756,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogSink()), generateSampleMessage(new protos.google.logging.v2.LogSink()), @@ -4721,10 +4777,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listSinks without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4733,7 +4789,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogSink()), generateSampleMessage(new protos.google.logging.v2.LogSink()), @@ -4770,10 +4826,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listSinks with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4782,7 +4838,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listSinks(request), expectedError); @@ -4798,10 +4854,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listSinksStream without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4810,7 +4866,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogSink()), generateSampleMessage(new protos.google.logging.v2.LogSink()), @@ -4849,10 +4905,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listSinksStream with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4861,7 +4917,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listSinks.createStream = stubPageStreamingCall( undefined, @@ -4897,10 +4953,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listSinks without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4909,7 +4965,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogSink()), generateSampleMessage(new protos.google.logging.v2.LogSink()), @@ -4939,10 +4995,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listSinks with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListSinksRequest(), ); @@ -4951,7 +5007,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall( undefined, @@ -4982,10 +5038,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('listLinks', () => { it('invokes listLinks without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -4994,7 +5050,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.Link()), generateSampleMessage(new protos.google.logging.v2.Link()), @@ -5015,10 +5071,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listLinks without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5027,7 +5083,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.Link()), generateSampleMessage(new protos.google.logging.v2.Link()), @@ -5064,10 +5120,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listLinks with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5076,7 +5132,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listLinks = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listLinks(request), expectedError); @@ -5092,10 +5148,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listLinksStream without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5104,7 +5160,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.Link()), generateSampleMessage(new protos.google.logging.v2.Link()), @@ -5143,10 +5199,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listLinksStream with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5155,7 +5211,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLinks.createStream = stubPageStreamingCall( undefined, @@ -5191,10 +5247,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listLinks without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5203,7 +5259,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.Link()), generateSampleMessage(new protos.google.logging.v2.Link()), @@ -5233,10 +5289,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listLinks with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLinksRequest(), ); @@ -5245,7 +5301,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLinks.asyncIterate = stubAsyncIterationCall( undefined, @@ -5276,10 +5332,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('listExclusions', () => { it('invokes listExclusions without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5288,7 +5344,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogExclusion()), generateSampleMessage(new protos.google.logging.v2.LogExclusion()), @@ -5309,10 +5365,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listExclusions without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5321,7 +5377,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogExclusion()), generateSampleMessage(new protos.google.logging.v2.LogExclusion()), @@ -5358,10 +5414,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listExclusions with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5370,7 +5426,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listExclusions = stubSimpleCall( undefined, @@ -5389,10 +5445,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listExclusionsStream without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5401,7 +5457,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogExclusion()), generateSampleMessage(new protos.google.logging.v2.LogExclusion()), @@ -5440,10 +5496,10 @@ describe('v2.ConfigServiceV2Client', () => { it('invokes listExclusionsStream with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5452,7 +5508,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -5486,10 +5542,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listExclusions without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5498,7 +5554,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogExclusion()), generateSampleMessage(new protos.google.logging.v2.LogExclusion()), @@ -5529,10 +5585,10 @@ describe('v2.ConfigServiceV2Client', () => { it('uses async iteration with listExclusions with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListExclusionsRequest(), ); @@ -5541,7 +5597,7 @@ describe('v2.ConfigServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -5570,10 +5626,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('getOperation', () => { it('invokes getOperation without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new operationsProtos.google.longrunning.GetOperationRequest(), ); @@ -5591,7 +5647,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes getOperation without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5604,20 +5660,24 @@ describe('v2.ConfigServiceV2Client', () => { .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); - } - }, - ); + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); @@ -5625,7 +5685,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes getOperation with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5649,10 +5709,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('cancelOperation', () => { it('invokes cancelOperation without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new operationsProtos.google.longrunning.CancelOperationRequest(), ); @@ -5671,7 +5731,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes cancelOperation without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5684,20 +5744,24 @@ describe('v2.ConfigServiceV2Client', () => { .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); - } - }, - ); + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); @@ -5705,7 +5769,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes cancelOperation with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5729,10 +5793,10 @@ describe('v2.ConfigServiceV2Client', () => { describe('deleteOperation', () => { it('invokes deleteOperation without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new operationsProtos.google.longrunning.DeleteOperationRequest(), ); @@ -5751,7 +5815,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes deleteOperation without error using callback', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5764,20 +5828,24 @@ describe('v2.ConfigServiceV2Client', () => { .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); - } - }, - ); + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); @@ -5785,7 +5853,7 @@ describe('v2.ConfigServiceV2Client', () => { }); it('invokes deleteOperation with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5809,7 +5877,7 @@ describe('v2.ConfigServiceV2Client', () => { describe('listOperationsAsync', () => { it('uses async iteration with listOperations without error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); const request = generateSampleMessage( @@ -5828,8 +5896,7 @@ describe('v2.ConfigServiceV2Client', () => { ]; client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; + const responses: operationsProtos.google.longrunning.IOperation[] = []; const iterable = client.operationsClient.listOperationsAsync(request); for await (const resource of iterable) { responses.push(resource!); @@ -5845,10 +5912,10 @@ describe('v2.ConfigServiceV2Client', () => { }); it('uses async iteration with listOperations with error', async () => { const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new operationsProtos.google.longrunning.ListOperationsRequest(), ); @@ -5857,8 +5924,7 @@ describe('v2.ConfigServiceV2Client', () => { stubAsyncIterationCall(undefined, expectedError); const iterable = client.operationsClient.listOperationsAsync(request); await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; + const responses: operationsProtos.google.longrunning.IOperation[] = []; for await (const resource of iterable) { responses.push(resource!); } @@ -5874,16 +5940,16 @@ describe('v2.ConfigServiceV2Client', () => { }); describe('Path templates', () => { - describe('billingAccountCmekSettings', () => { + describe('billingAccountCmekSettings', async () => { const fakePath = '/rendered/path/billingAccountCmekSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -5923,17 +5989,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountExclusion', () => { + describe('billingAccountExclusion', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -5986,7 +6052,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountLocationBucket', () => { + describe('billingAccountLocationBucket', async () => { const fakePath = '/rendered/path/billingAccountLocationBucket'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -5994,10 +6060,10 @@ describe('v2.ConfigServiceV2Client', () => { bucket: 'bucketValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketPathTemplate.match = @@ -6065,7 +6131,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketLink', () => { + describe('billingAccountLocationBucketLink', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketLink'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -6074,10 +6140,10 @@ describe('v2.ConfigServiceV2Client', () => { link: 'linkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = @@ -6162,7 +6228,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketView', () => { + describe('billingAccountLocationBucketView', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketView'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -6171,10 +6237,10 @@ describe('v2.ConfigServiceV2Client', () => { view: 'viewValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = @@ -6259,17 +6325,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountLog', () => { + describe('billingAccountLog', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6321,16 +6387,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountSettings', () => { + describe('billingAccountSettings', async () => { const fakePath = '/rendered/path/billingAccountSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6366,17 +6432,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('billingAccountSink', () => { + describe('billingAccountSink', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6428,16 +6494,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderCmekSettings', () => { + describe('folderCmekSettings', async () => { const fakePath = '/rendered/path/folderCmekSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6472,17 +6538,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderExclusion', () => { + describe('folderExclusion', async () => { const fakePath = '/rendered/path/folderExclusion'; const expectedParameters = { folder: 'folderValue', exclusion: 'exclusionValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6524,7 +6590,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderLocationBucket', () => { + describe('folderLocationBucket', async () => { const fakePath = '/rendered/path/folderLocationBucket'; const expectedParameters = { folder: 'folderValue', @@ -6532,10 +6598,10 @@ describe('v2.ConfigServiceV2Client', () => { bucket: 'bucketValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6601,7 +6667,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderLocationBucketLink', () => { + describe('folderLocationBucketLink', async () => { const fakePath = '/rendered/path/folderLocationBucketLink'; const expectedParameters = { folder: 'folderValue', @@ -6610,10 +6676,10 @@ describe('v2.ConfigServiceV2Client', () => { link: 'linkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6696,7 +6762,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderLocationBucketView', () => { + describe('folderLocationBucketView', async () => { const fakePath = '/rendered/path/folderLocationBucketView'; const expectedParameters = { folder: 'folderValue', @@ -6705,10 +6771,10 @@ describe('v2.ConfigServiceV2Client', () => { view: 'viewValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6791,17 +6857,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderLog', () => { + describe('folderLog', async () => { const fakePath = '/rendered/path/folderLog'; const expectedParameters = { folder: 'folderValue', log: 'logValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6840,16 +6906,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderSettings', () => { + describe('folderSettings', async () => { const fakePath = '/rendered/path/folderSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6878,17 +6944,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('folderSink', () => { + describe('folderSink', async () => { const fakePath = '/rendered/path/folderSink'; const expectedParameters = { folder: 'folderValue', sink: 'sinkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6927,17 +6993,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('location', () => { + describe('location', async () => { const fakePath = '/rendered/path/location'; const expectedParameters = { project: 'projectValue', location: 'locationValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.locationPathTemplate.render = sinon .stub() .returns(fakePath); @@ -6976,17 +7042,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('logMetric', () => { + describe('logMetric', async () => { const fakePath = '/rendered/path/logMetric'; const expectedParameters = { project: 'projectValue', metric: 'metricValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.logMetricPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7025,16 +7091,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationCmekSettings', () => { + describe('organizationCmekSettings', async () => { const fakePath = '/rendered/path/organizationCmekSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7070,17 +7136,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationExclusion', () => { + describe('organizationExclusion', async () => { const fakePath = '/rendered/path/organizationExclusion'; const expectedParameters = { organization: 'organizationValue', exclusion: 'exclusionValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7133,7 +7199,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationLocationBucket', () => { + describe('organizationLocationBucket', async () => { const fakePath = '/rendered/path/organizationLocationBucket'; const expectedParameters = { organization: 'organizationValue', @@ -7141,10 +7207,10 @@ describe('v2.ConfigServiceV2Client', () => { bucket: 'bucketValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7212,7 +7278,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationLocationBucketLink', () => { + describe('organizationLocationBucketLink', async () => { const fakePath = '/rendered/path/organizationLocationBucketLink'; const expectedParameters = { organization: 'organizationValue', @@ -7221,10 +7287,10 @@ describe('v2.ConfigServiceV2Client', () => { link: 'linkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = @@ -7307,7 +7373,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationLocationBucketView', () => { + describe('organizationLocationBucketView', async () => { const fakePath = '/rendered/path/organizationLocationBucketView'; const expectedParameters = { organization: 'organizationValue', @@ -7316,10 +7382,10 @@ describe('v2.ConfigServiceV2Client', () => { view: 'viewValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketViewPathTemplate.match = @@ -7402,17 +7468,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationLog', () => { + describe('organizationLog', async () => { const fakePath = '/rendered/path/organizationLog'; const expectedParameters = { organization: 'organizationValue', log: 'logValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7455,16 +7521,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationSettings', () => { + describe('organizationSettings', async () => { const fakePath = '/rendered/path/organizationSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7500,17 +7566,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('organizationSink', () => { + describe('organizationSink', async () => { const fakePath = '/rendered/path/organizationSink'; const expectedParameters = { organization: 'organizationValue', sink: 'sinkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7556,16 +7622,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('project', () => { + describe('project', async () => { const fakePath = '/rendered/path/project'; const expectedParameters = { project: 'projectValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7594,16 +7660,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectCmekSettings', () => { + describe('projectCmekSettings', async () => { const fakePath = '/rendered/path/projectCmekSettings'; const expectedParameters = { project: 'projectValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7638,17 +7704,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectExclusion', () => { + describe('projectExclusion', async () => { const fakePath = '/rendered/path/projectExclusion'; const expectedParameters = { project: 'projectValue', exclusion: 'exclusionValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7693,7 +7759,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectLocationBucket', () => { + describe('projectLocationBucket', async () => { const fakePath = '/rendered/path/projectLocationBucket'; const expectedParameters = { project: 'projectValue', @@ -7701,10 +7767,10 @@ describe('v2.ConfigServiceV2Client', () => { bucket: 'bucketValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7772,7 +7838,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectLocationBucketLink', () => { + describe('projectLocationBucketLink', async () => { const fakePath = '/rendered/path/projectLocationBucketLink'; const expectedParameters = { project: 'projectValue', @@ -7781,10 +7847,10 @@ describe('v2.ConfigServiceV2Client', () => { link: 'linkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7867,7 +7933,7 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectLocationBucketView', () => { + describe('projectLocationBucketView', async () => { const fakePath = '/rendered/path/projectLocationBucketView'; const expectedParameters = { project: 'projectValue', @@ -7876,10 +7942,10 @@ describe('v2.ConfigServiceV2Client', () => { view: 'viewValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -7962,17 +8028,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectLog', () => { + describe('projectLog', async () => { const fakePath = '/rendered/path/projectLog'; const expectedParameters = { project: 'projectValue', log: 'logValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -8011,16 +8077,16 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectSettings', () => { + describe('projectSettings', async () => { const fakePath = '/rendered/path/projectSettings'; const expectedParameters = { project: 'projectValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -8049,17 +8115,17 @@ describe('v2.ConfigServiceV2Client', () => { }); }); - describe('projectSink', () => { + describe('projectSink', async () => { const fakePath = '/rendered/path/projectSink'; const expectedParameters = { project: 'projectValue', sink: 'sinkValue', }; const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSinkPathTemplate.render = sinon .stub() .returns(fakePath); diff --git a/handwritten/logging/test/gapic_logging_service_v2_v2.ts b/handwritten/logging/test/gapic_logging_service_v2_v2.ts index fd926082626..9005cf668f4 100644 --- a/handwritten/logging/test/gapic_logging_service_v2_v2.ts +++ b/handwritten/logging/test/gapic_logging_service_v2_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as loggingservicev2Module from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -45,7 +45,7 @@ function getTypeDefaultValue(typeName: string, fields: string[]) { function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); + ).toObject(instance as protobuf.Message, { defaults: true }); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject, ) as T; @@ -131,9 +131,9 @@ function stubAsyncIterationCall( return Promise.reject(error); } if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); + return Promise.resolve({ done: true, value: undefined }); } - return Promise.resolve({done: false, value: responses![counter++]}); + return Promise.resolve({ done: false, value: responses![counter++] }); }, }; }, @@ -253,7 +253,7 @@ describe('v2.LoggingServiceV2Client', () => { it('has initialize method and supports deferred initialization', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.loggingServiceV2Stub, undefined); @@ -261,33 +261,45 @@ describe('v2.LoggingServiceV2Client', () => { assert(client.loggingServiceV2Stub); }); - it('has close method for the initialized client', done => { + it('has close method for the initialized client', (done) => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); - assert(client.loggingServiceV2Stub); - client.close().then(() => { - done(); + client.initialize().catch((err) => { + throw err; }); + assert(client.loggingServiceV2Stub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); - it('has close method for the non-initialized client', done => { + it('has close method for the non-initialized client', (done) => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.loggingServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); @@ -299,7 +311,7 @@ describe('v2.LoggingServiceV2Client', () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon @@ -322,10 +334,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('deleteLog', () => { it('invokes deleteLog without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogRequest(), ); @@ -334,7 +346,7 @@ describe('v2.LoggingServiceV2Client', () => { ['logName'], ); request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -353,10 +365,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes deleteLog without error using callback', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogRequest(), ); @@ -365,7 +377,7 @@ describe('v2.LoggingServiceV2Client', () => { ['logName'], ); request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -400,10 +412,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes deleteLog with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogRequest(), ); @@ -412,7 +424,7 @@ describe('v2.LoggingServiceV2Client', () => { ['logName'], ); request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1}`; + const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); await assert.rejects(client.deleteLog(request), expectedError); @@ -428,10 +440,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes deleteLog with closed client', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogRequest(), ); @@ -441,7 +453,9 @@ describe('v2.LoggingServiceV2Client', () => { ); request.logName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteLog(request), expectedError); }); }); @@ -449,10 +463,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('writeLogEntries', () => { it('invokes writeLogEntries without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.WriteLogEntriesRequest(), ); @@ -466,10 +480,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes writeLogEntries without error using callback', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.WriteLogEntriesRequest(), ); @@ -499,10 +513,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes writeLogEntries with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.WriteLogEntriesRequest(), ); @@ -516,15 +530,17 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes writeLogEntries with closed client', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.WriteLogEntriesRequest(), ); const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.writeLogEntries(request), expectedError); }); }); @@ -532,10 +548,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('tailLogEntries', () => { it('invokes tailLogEntries without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.TailLogEntriesRequest(), ); @@ -575,10 +591,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes tailLogEntries with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.TailLogEntriesRequest(), ); @@ -618,10 +634,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('listLogEntries', () => { it('invokes listLogEntries without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -637,10 +653,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogEntries without error using callback', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -672,10 +688,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogEntries with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -689,10 +705,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogEntriesStream without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -727,10 +743,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogEntriesStream with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -760,10 +776,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listLogEntries without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -790,10 +806,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listLogEntries with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogEntriesRequest(), ); @@ -819,10 +835,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('listMonitoredResourceDescriptors', () => { it('invokes listMonitoredResourceDescriptors without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -845,10 +861,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listMonitoredResourceDescriptors without error using callback', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -886,10 +902,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listMonitoredResourceDescriptors with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -906,10 +922,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listMonitoredResourceDescriptorsStream without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -959,10 +975,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listMonitoredResourceDescriptorsStream with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -1001,10 +1017,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -1038,10 +1054,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest(), ); @@ -1068,10 +1084,10 @@ describe('v2.LoggingServiceV2Client', () => { describe('listLogs', () => { it('invokes listLogs without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1080,7 +1096,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `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); @@ -1097,10 +1113,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogs without error using callback', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1109,7 +1125,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [new String(), new String(), new String()]; client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); @@ -1139,10 +1155,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogs with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1151,7 +1167,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listLogs(request), expectedError); @@ -1167,10 +1183,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogsStream without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1179,7 +1195,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [new String(), new String(), new String()]; client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); @@ -1214,10 +1230,10 @@ describe('v2.LoggingServiceV2Client', () => { it('invokes listLogsStream with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1226,7 +1242,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLogs.createStream = stubPageStreamingCall( undefined, @@ -1262,10 +1278,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listLogs without error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1274,7 +1290,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [new String(), new String(), new String()]; client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); @@ -1300,10 +1316,10 @@ describe('v2.LoggingServiceV2Client', () => { it('uses async iteration with listLogs with error', async () => { const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogsRequest(), ); @@ -1312,7 +1328,7 @@ describe('v2.LoggingServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall( undefined, @@ -1341,16 +1357,16 @@ describe('v2.LoggingServiceV2Client', () => { }); describe('Path templates', () => { - describe('billingAccountCmekSettings', () => { + describe('billingAccountCmekSettings', async () => { const fakePath = '/rendered/path/billingAccountCmekSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1390,17 +1406,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountExclusion', () => { + describe('billingAccountExclusion', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1453,7 +1469,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountLocationBucket', () => { + describe('billingAccountLocationBucket', async () => { const fakePath = '/rendered/path/billingAccountLocationBucket'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1461,10 +1477,10 @@ describe('v2.LoggingServiceV2Client', () => { bucket: 'bucketValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketPathTemplate.match = @@ -1532,7 +1548,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketLink', () => { + describe('billingAccountLocationBucketLink', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketLink'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1541,10 +1557,10 @@ describe('v2.LoggingServiceV2Client', () => { link: 'linkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = @@ -1629,7 +1645,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketView', () => { + describe('billingAccountLocationBucketView', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketView'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1638,10 +1654,10 @@ describe('v2.LoggingServiceV2Client', () => { view: 'viewValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = @@ -1726,17 +1742,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountLog', () => { + describe('billingAccountLog', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1788,16 +1804,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountSettings', () => { + describe('billingAccountSettings', async () => { const fakePath = '/rendered/path/billingAccountSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1833,17 +1849,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('billingAccountSink', () => { + describe('billingAccountSink', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1895,16 +1911,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderCmekSettings', () => { + describe('folderCmekSettings', async () => { const fakePath = '/rendered/path/folderCmekSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1939,17 +1955,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderExclusion', () => { + describe('folderExclusion', async () => { const fakePath = '/rendered/path/folderExclusion'; const expectedParameters = { folder: 'folderValue', exclusion: 'exclusionValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1991,7 +2007,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderLocationBucket', () => { + describe('folderLocationBucket', async () => { const fakePath = '/rendered/path/folderLocationBucket'; const expectedParameters = { folder: 'folderValue', @@ -1999,10 +2015,10 @@ describe('v2.LoggingServiceV2Client', () => { bucket: 'bucketValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2068,7 +2084,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderLocationBucketLink', () => { + describe('folderLocationBucketLink', async () => { const fakePath = '/rendered/path/folderLocationBucketLink'; const expectedParameters = { folder: 'folderValue', @@ -2077,10 +2093,10 @@ describe('v2.LoggingServiceV2Client', () => { link: 'linkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2163,7 +2179,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderLocationBucketView', () => { + describe('folderLocationBucketView', async () => { const fakePath = '/rendered/path/folderLocationBucketView'; const expectedParameters = { folder: 'folderValue', @@ -2172,10 +2188,10 @@ describe('v2.LoggingServiceV2Client', () => { view: 'viewValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2258,17 +2274,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderLog', () => { + describe('folderLog', async () => { const fakePath = '/rendered/path/folderLog'; const expectedParameters = { folder: 'folderValue', log: 'logValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2307,16 +2323,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderSettings', () => { + describe('folderSettings', async () => { const fakePath = '/rendered/path/folderSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2345,17 +2361,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('folderSink', () => { + describe('folderSink', async () => { const fakePath = '/rendered/path/folderSink'; const expectedParameters = { folder: 'folderValue', sink: 'sinkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2394,17 +2410,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('logMetric', () => { + describe('logMetric', async () => { const fakePath = '/rendered/path/logMetric'; const expectedParameters = { project: 'projectValue', metric: 'metricValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.logMetricPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2443,16 +2459,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationCmekSettings', () => { + describe('organizationCmekSettings', async () => { const fakePath = '/rendered/path/organizationCmekSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2488,17 +2504,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationExclusion', () => { + describe('organizationExclusion', async () => { const fakePath = '/rendered/path/organizationExclusion'; const expectedParameters = { organization: 'organizationValue', exclusion: 'exclusionValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2551,7 +2567,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationLocationBucket', () => { + describe('organizationLocationBucket', async () => { const fakePath = '/rendered/path/organizationLocationBucket'; const expectedParameters = { organization: 'organizationValue', @@ -2559,10 +2575,10 @@ describe('v2.LoggingServiceV2Client', () => { bucket: 'bucketValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2630,7 +2646,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationLocationBucketLink', () => { + describe('organizationLocationBucketLink', async () => { const fakePath = '/rendered/path/organizationLocationBucketLink'; const expectedParameters = { organization: 'organizationValue', @@ -2639,10 +2655,10 @@ describe('v2.LoggingServiceV2Client', () => { link: 'linkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = @@ -2725,7 +2741,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationLocationBucketView', () => { + describe('organizationLocationBucketView', async () => { const fakePath = '/rendered/path/organizationLocationBucketView'; const expectedParameters = { organization: 'organizationValue', @@ -2734,10 +2750,10 @@ describe('v2.LoggingServiceV2Client', () => { view: 'viewValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketViewPathTemplate.match = @@ -2820,17 +2836,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationLog', () => { + describe('organizationLog', async () => { const fakePath = '/rendered/path/organizationLog'; const expectedParameters = { organization: 'organizationValue', log: 'logValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2873,16 +2889,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationSettings', () => { + describe('organizationSettings', async () => { const fakePath = '/rendered/path/organizationSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2918,17 +2934,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('organizationSink', () => { + describe('organizationSink', async () => { const fakePath = '/rendered/path/organizationSink'; const expectedParameters = { organization: 'organizationValue', sink: 'sinkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2974,16 +2990,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('project', () => { + describe('project', async () => { const fakePath = '/rendered/path/project'; const expectedParameters = { project: 'projectValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3012,16 +3028,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectCmekSettings', () => { + describe('projectCmekSettings', async () => { const fakePath = '/rendered/path/projectCmekSettings'; const expectedParameters = { project: 'projectValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3056,17 +3072,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectExclusion', () => { + describe('projectExclusion', async () => { const fakePath = '/rendered/path/projectExclusion'; const expectedParameters = { project: 'projectValue', exclusion: 'exclusionValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3111,7 +3127,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectLocationBucket', () => { + describe('projectLocationBucket', async () => { const fakePath = '/rendered/path/projectLocationBucket'; const expectedParameters = { project: 'projectValue', @@ -3119,10 +3135,10 @@ describe('v2.LoggingServiceV2Client', () => { bucket: 'bucketValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3190,7 +3206,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectLocationBucketLink', () => { + describe('projectLocationBucketLink', async () => { const fakePath = '/rendered/path/projectLocationBucketLink'; const expectedParameters = { project: 'projectValue', @@ -3199,10 +3215,10 @@ describe('v2.LoggingServiceV2Client', () => { link: 'linkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3285,7 +3301,7 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectLocationBucketView', () => { + describe('projectLocationBucketView', async () => { const fakePath = '/rendered/path/projectLocationBucketView'; const expectedParameters = { project: 'projectValue', @@ -3294,10 +3310,10 @@ describe('v2.LoggingServiceV2Client', () => { view: 'viewValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3380,17 +3396,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectLog', () => { + describe('projectLog', async () => { const fakePath = '/rendered/path/projectLog'; const expectedParameters = { project: 'projectValue', log: 'logValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3429,16 +3445,16 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectSettings', () => { + describe('projectSettings', async () => { const fakePath = '/rendered/path/projectSettings'; const expectedParameters = { project: 'projectValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3467,17 +3483,17 @@ describe('v2.LoggingServiceV2Client', () => { }); }); - describe('projectSink', () => { + describe('projectSink', async () => { const fakePath = '/rendered/path/projectSink'; const expectedParameters = { project: 'projectValue', sink: 'sinkValue', }; const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSinkPathTemplate.render = sinon .stub() .returns(fakePath); diff --git a/handwritten/logging/test/gapic_metrics_service_v2_v2.ts b/handwritten/logging/test/gapic_metrics_service_v2_v2.ts index 90a774f0765..08d00805957 100644 --- a/handwritten/logging/test/gapic_metrics_service_v2_v2.ts +++ b/handwritten/logging/test/gapic_metrics_service_v2_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as metricsservicev2Module from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -45,7 +45,7 @@ function getTypeDefaultValue(typeName: string, fields: string[]) { function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); + ).toObject(instance as protobuf.Message, { defaults: true }); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject, ) as T; @@ -117,9 +117,9 @@ function stubAsyncIterationCall( return Promise.reject(error); } if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); + return Promise.resolve({ done: true, value: undefined }); } - return Promise.resolve({done: false, value: responses![counter++]}); + return Promise.resolve({ done: false, value: responses![counter++] }); }, }; }, @@ -239,7 +239,7 @@ describe('v2.MetricsServiceV2Client', () => { it('has initialize method and supports deferred initialization', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.metricsServiceV2Stub, undefined); @@ -247,33 +247,45 @@ describe('v2.MetricsServiceV2Client', () => { assert(client.metricsServiceV2Stub); }); - it('has close method for the initialized client', done => { + it('has close method for the initialized client', (done) => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); - assert(client.metricsServiceV2Stub); - client.close().then(() => { - done(); + client.initialize().catch((err) => { + throw err; }); + assert(client.metricsServiceV2Stub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); - it('has close method for the non-initialized client', done => { + it('has close method for the non-initialized client', (done) => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); assert.strictEqual(client.metricsServiceV2Stub, undefined); - client.close().then(() => { - done(); - }); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); @@ -285,7 +297,7 @@ describe('v2.MetricsServiceV2Client', () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); client.auth.getProjectId = sinon @@ -308,10 +320,10 @@ describe('v2.MetricsServiceV2Client', () => { describe('getLogMetric', () => { it('invokes getLogMetric without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLogMetricRequest(), ); @@ -320,7 +332,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -339,10 +351,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes getLogMetric without error using callback', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLogMetricRequest(), ); @@ -351,7 +363,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -386,10 +398,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes getLogMetric with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLogMetricRequest(), ); @@ -398,7 +410,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getLogMetric = stubSimpleCall( undefined, @@ -417,10 +429,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes getLogMetric with closed client', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.GetLogMetricRequest(), ); @@ -430,7 +442,9 @@ describe('v2.MetricsServiceV2Client', () => { ); request.metricName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.getLogMetric(request), expectedError); }); }); @@ -438,10 +452,10 @@ describe('v2.MetricsServiceV2Client', () => { describe('createLogMetric', () => { it('invokes createLogMetric without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLogMetricRequest(), ); @@ -450,7 +464,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -469,10 +483,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes createLogMetric without error using callback', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLogMetricRequest(), ); @@ -481,7 +495,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -516,10 +530,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes createLogMetric with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLogMetricRequest(), ); @@ -528,7 +542,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createLogMetric = stubSimpleCall( undefined, @@ -547,10 +561,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes createLogMetric with closed client', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.CreateLogMetricRequest(), ); @@ -560,7 +574,9 @@ describe('v2.MetricsServiceV2Client', () => { ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.createLogMetric(request), expectedError); }); }); @@ -568,10 +584,10 @@ describe('v2.MetricsServiceV2Client', () => { describe('updateLogMetric', () => { it('invokes updateLogMetric without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateLogMetricRequest(), ); @@ -580,7 +596,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -599,10 +615,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes updateLogMetric without error using callback', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateLogMetricRequest(), ); @@ -611,7 +627,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.logging.v2.LogMetric(), ); @@ -646,10 +662,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes updateLogMetric with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateLogMetricRequest(), ); @@ -658,7 +674,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateLogMetric = stubSimpleCall( undefined, @@ -677,10 +693,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes updateLogMetric with closed client', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.UpdateLogMetricRequest(), ); @@ -690,7 +706,9 @@ describe('v2.MetricsServiceV2Client', () => { ); request.metricName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.updateLogMetric(request), expectedError); }); }); @@ -698,10 +716,10 @@ describe('v2.MetricsServiceV2Client', () => { describe('deleteLogMetric', () => { it('invokes deleteLogMetric without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogMetricRequest(), ); @@ -710,7 +728,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -729,10 +747,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes deleteLogMetric without error using callback', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogMetricRequest(), ); @@ -741,7 +759,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty(), ); @@ -776,10 +794,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes deleteLogMetric with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogMetricRequest(), ); @@ -788,7 +806,7 @@ describe('v2.MetricsServiceV2Client', () => { ['metricName'], ); request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1}`; + const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteLogMetric = stubSimpleCall( undefined, @@ -807,10 +825,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes deleteLogMetric with closed client', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.DeleteLogMetricRequest(), ); @@ -820,7 +838,9 @@ describe('v2.MetricsServiceV2Client', () => { ); request.metricName = defaultValue1; const expectedError = new Error('The client has already been closed.'); - client.close(); + client.close().catch((err) => { + throw err; + }); await assert.rejects(client.deleteLogMetric(request), expectedError); }); }); @@ -828,10 +848,10 @@ describe('v2.MetricsServiceV2Client', () => { describe('listLogMetrics', () => { it('invokes listLogMetrics without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -840,7 +860,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogMetric()), generateSampleMessage(new protos.google.logging.v2.LogMetric()), @@ -861,10 +881,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes listLogMetrics without error using callback', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -873,7 +893,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogMetric()), generateSampleMessage(new protos.google.logging.v2.LogMetric()), @@ -910,10 +930,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes listLogMetrics with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -922,7 +942,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listLogMetrics = stubSimpleCall( undefined, @@ -941,10 +961,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes listLogMetricsStream without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -953,7 +973,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogMetric()), generateSampleMessage(new protos.google.logging.v2.LogMetric()), @@ -992,10 +1012,10 @@ describe('v2.MetricsServiceV2Client', () => { it('invokes listLogMetricsStream with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -1004,7 +1024,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1038,10 +1058,10 @@ describe('v2.MetricsServiceV2Client', () => { it('uses async iteration with listLogMetrics without error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -1050,7 +1070,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.logging.v2.LogMetric()), generateSampleMessage(new protos.google.logging.v2.LogMetric()), @@ -1081,10 +1101,10 @@ describe('v2.MetricsServiceV2Client', () => { it('uses async iteration with listLogMetrics with error', async () => { const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); const request = generateSampleMessage( new protos.google.logging.v2.ListLogMetricsRequest(), ); @@ -1093,7 +1113,7 @@ describe('v2.MetricsServiceV2Client', () => { ['parent'], ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1121,16 +1141,16 @@ describe('v2.MetricsServiceV2Client', () => { }); describe('Path templates', () => { - describe('billingAccountCmekSettings', () => { + describe('billingAccountCmekSettings', async () => { const fakePath = '/rendered/path/billingAccountCmekSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1170,17 +1190,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountExclusion', () => { + describe('billingAccountExclusion', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1233,7 +1253,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountLocationBucket', () => { + describe('billingAccountLocationBucket', async () => { const fakePath = '/rendered/path/billingAccountLocationBucket'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1241,10 +1261,10 @@ describe('v2.MetricsServiceV2Client', () => { bucket: 'bucketValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketPathTemplate.match = @@ -1312,7 +1332,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketLink', () => { + describe('billingAccountLocationBucketLink', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketLink'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1321,10 +1341,10 @@ describe('v2.MetricsServiceV2Client', () => { link: 'linkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match = @@ -1409,7 +1429,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountLocationBucketView', () => { + describe('billingAccountLocationBucketView', async () => { const fakePath = '/rendered/path/billingAccountLocationBucketView'; const expectedParameters = { billing_account: 'billingAccountValue', @@ -1418,10 +1438,10 @@ describe('v2.MetricsServiceV2Client', () => { view: 'viewValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = @@ -1506,17 +1526,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountLog', () => { + describe('billingAccountLog', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1568,16 +1588,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountSettings', () => { + describe('billingAccountSettings', async () => { const fakePath = '/rendered/path/billingAccountSettings'; const expectedParameters = { billing_account: 'billingAccountValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1613,17 +1633,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('billingAccountSink', () => { + describe('billingAccountSink', async () => { 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'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.billingAccountSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1675,16 +1695,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderCmekSettings', () => { + describe('folderCmekSettings', async () => { const fakePath = '/rendered/path/folderCmekSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1719,17 +1739,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderExclusion', () => { + describe('folderExclusion', async () => { const fakePath = '/rendered/path/folderExclusion'; const expectedParameters = { folder: 'folderValue', exclusion: 'exclusionValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1771,7 +1791,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderLocationBucket', () => { + describe('folderLocationBucket', async () => { const fakePath = '/rendered/path/folderLocationBucket'; const expectedParameters = { folder: 'folderValue', @@ -1779,10 +1799,10 @@ describe('v2.MetricsServiceV2Client', () => { bucket: 'bucketValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1848,7 +1868,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderLocationBucketLink', () => { + describe('folderLocationBucketLink', async () => { const fakePath = '/rendered/path/folderLocationBucketLink'; const expectedParameters = { folder: 'folderValue', @@ -1857,10 +1877,10 @@ describe('v2.MetricsServiceV2Client', () => { link: 'linkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -1943,7 +1963,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderLocationBucketView', () => { + describe('folderLocationBucketView', async () => { const fakePath = '/rendered/path/folderLocationBucketView'; const expectedParameters = { folder: 'folderValue', @@ -1952,10 +1972,10 @@ describe('v2.MetricsServiceV2Client', () => { view: 'viewValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2038,17 +2058,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderLog', () => { + describe('folderLog', async () => { const fakePath = '/rendered/path/folderLog'; const expectedParameters = { folder: 'folderValue', log: 'logValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2087,16 +2107,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderSettings', () => { + describe('folderSettings', async () => { const fakePath = '/rendered/path/folderSettings'; const expectedParameters = { folder: 'folderValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2125,17 +2145,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('folderSink', () => { + describe('folderSink', async () => { const fakePath = '/rendered/path/folderSink'; const expectedParameters = { folder: 'folderValue', sink: 'sinkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.folderSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2174,17 +2194,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('logMetric', () => { + describe('logMetric', async () => { const fakePath = '/rendered/path/logMetric'; const expectedParameters = { project: 'projectValue', metric: 'metricValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.logMetricPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2223,16 +2243,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationCmekSettings', () => { + describe('organizationCmekSettings', async () => { const fakePath = '/rendered/path/organizationCmekSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2268,17 +2288,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationExclusion', () => { + describe('organizationExclusion', async () => { const fakePath = '/rendered/path/organizationExclusion'; const expectedParameters = { organization: 'organizationValue', exclusion: 'exclusionValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2331,7 +2351,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationLocationBucket', () => { + describe('organizationLocationBucket', async () => { const fakePath = '/rendered/path/organizationLocationBucket'; const expectedParameters = { organization: 'organizationValue', @@ -2339,10 +2359,10 @@ describe('v2.MetricsServiceV2Client', () => { bucket: 'bucketValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2410,7 +2430,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationLocationBucketLink', () => { + describe('organizationLocationBucketLink', async () => { const fakePath = '/rendered/path/organizationLocationBucketLink'; const expectedParameters = { organization: 'organizationValue', @@ -2419,10 +2439,10 @@ describe('v2.MetricsServiceV2Client', () => { link: 'linkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketLinkPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketLinkPathTemplate.match = @@ -2505,7 +2525,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationLocationBucketView', () => { + describe('organizationLocationBucketView', async () => { const fakePath = '/rendered/path/organizationLocationBucketView'; const expectedParameters = { organization: 'organizationValue', @@ -2514,10 +2534,10 @@ describe('v2.MetricsServiceV2Client', () => { view: 'viewValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLocationBucketViewPathTemplate.render = sinon.stub().returns(fakePath); client.pathTemplates.organizationLocationBucketViewPathTemplate.match = @@ -2600,17 +2620,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationLog', () => { + describe('organizationLog', async () => { const fakePath = '/rendered/path/organizationLog'; const expectedParameters = { organization: 'organizationValue', log: 'logValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2653,16 +2673,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationSettings', () => { + describe('organizationSettings', async () => { const fakePath = '/rendered/path/organizationSettings'; const expectedParameters = { organization: 'organizationValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2698,17 +2718,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('organizationSink', () => { + describe('organizationSink', async () => { const fakePath = '/rendered/path/organizationSink'; const expectedParameters = { organization: 'organizationValue', sink: 'sinkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.organizationSinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2754,16 +2774,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('project', () => { + describe('project', async () => { const fakePath = '/rendered/path/project'; const expectedParameters = { project: 'projectValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2792,16 +2812,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectCmekSettings', () => { + describe('projectCmekSettings', async () => { const fakePath = '/rendered/path/projectCmekSettings'; const expectedParameters = { project: 'projectValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectCmekSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2836,17 +2856,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectExclusion', () => { + describe('projectExclusion', async () => { const fakePath = '/rendered/path/projectExclusion'; const expectedParameters = { project: 'projectValue', exclusion: 'exclusionValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectExclusionPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2891,7 +2911,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectLocationBucket', () => { + describe('projectLocationBucket', async () => { const fakePath = '/rendered/path/projectLocationBucket'; const expectedParameters = { project: 'projectValue', @@ -2899,10 +2919,10 @@ describe('v2.MetricsServiceV2Client', () => { bucket: 'bucketValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketPathTemplate.render = sinon .stub() .returns(fakePath); @@ -2970,7 +2990,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectLocationBucketLink', () => { + describe('projectLocationBucketLink', async () => { const fakePath = '/rendered/path/projectLocationBucketLink'; const expectedParameters = { project: 'projectValue', @@ -2979,10 +2999,10 @@ describe('v2.MetricsServiceV2Client', () => { link: 'linkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketLinkPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3065,7 +3085,7 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectLocationBucketView', () => { + describe('projectLocationBucketView', async () => { const fakePath = '/rendered/path/projectLocationBucketView'; const expectedParameters = { project: 'projectValue', @@ -3074,10 +3094,10 @@ describe('v2.MetricsServiceV2Client', () => { view: 'viewValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLocationBucketViewPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3160,17 +3180,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectLog', () => { + describe('projectLog', async () => { const fakePath = '/rendered/path/projectLog'; const expectedParameters = { project: 'projectValue', log: 'logValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectLogPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3209,16 +3229,16 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectSettings', () => { + describe('projectSettings', async () => { const fakePath = '/rendered/path/projectSettings'; const expectedParameters = { project: 'projectValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSettingsPathTemplate.render = sinon .stub() .returns(fakePath); @@ -3247,17 +3267,17 @@ describe('v2.MetricsServiceV2Client', () => { }); }); - describe('projectSink', () => { + describe('projectSink', async () => { const fakePath = '/rendered/path/projectSink'; const expectedParameters = { project: 'projectValue', sink: 'sinkValue', }; const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, + credentials: { client_email: 'bogus', private_key: 'bogus' }, projectId: 'bogus', }); - client.initialize(); + await client.initialize(); client.pathTemplates.projectSinkPathTemplate.render = sinon .stub() .returns(fakePath); diff --git a/handwritten/logging/tsconfig.json b/handwritten/logging/tsconfig.json index c78f1c884ef..ca73e7bfc82 100644 --- a/handwritten/logging/tsconfig.json +++ b/handwritten/logging/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "build", "resolveJsonModule": true, "lib": [ - "es2018", + "es2023", "dom" ] }, @@ -14,6 +14,9 @@ "src/**/*.ts", "test/*.ts", "test/**/*.ts", - "system-test/*.ts" + "system-test/*.ts", + "src/**/*.json", + "samples/**/*.json", + "protos/protos.json" ] } diff --git a/handwritten/logging/webpack.config.js b/handwritten/logging/webpack.config.js index 1cc3b570dfd..a37e80e5737 100644 --- a/handwritten/logging/webpack.config.js +++ b/handwritten/logging/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/, + exclude: /node_modules/ }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]grpc/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader', + use: 'null-loader' }, ], },